Error while adding ON_BN_CLICKED event.
-
Hi I have a class MyClass, which is derived from CWnd and COleDropTarget. class MyClass:public CWnd, public COleDropTarget { }; I am having a button in my class. While adding ON_BN_CLICKED(BUTTON_ID, OnClick) event in the message map entry, i am getting the following compiler error, Error C2594: 'Static cast': ambigious convertion form 'void (__thiscall MyClass::*) (void)' to AFX_PMSG. can anybody tell me what's the issue. Thanks
-
Hi I have a class MyClass, which is derived from CWnd and COleDropTarget. class MyClass:public CWnd, public COleDropTarget { }; I am having a button in my class. While adding ON_BN_CLICKED(BUTTON_ID, OnClick) event in the message map entry, i am getting the following compiler error, Error C2594: 'Static cast': ambigious convertion form 'void (__thiscall MyClass::*) (void)' to AFX_PMSG. can anybody tell me what's the issue. Thanks
Deepu Antony wrote:
ON_BN_CLICKED(BUTTON_ID, OnClick)
change it to
ON_BN_CLICKED(BUTTON_ID, &MyClass::OnClick)
Also, signature of the function should be like this
void FunctionName();
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
Deepu Antony wrote:
ON_BN_CLICKED(BUTTON_ID, OnClick)
change it to
ON_BN_CLICKED(BUTTON_ID, &MyClass::OnClick)
Also, signature of the function should be like this
void FunctionName();
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
Hi, Still i am getting the same error. :(
-
Hi I have a class MyClass, which is derived from CWnd and COleDropTarget. class MyClass:public CWnd, public COleDropTarget { }; I am having a button in my class. While adding ON_BN_CLICKED(BUTTON_ID, OnClick) event in the message map entry, i am getting the following compiler error, Error C2594: 'Static cast': ambigious convertion form 'void (__thiscall MyClass::*) (void)' to AFX_PMSG. can anybody tell me what's the issue. Thanks
the ambiguity is both CWnd and COleDropTarget are derived from CCmdTarget. Due to non-virtual inheritance, there will be multipe occurances of AFX_PMSG. Actually why do you inherit a window class from COleDropTarget? Refer COleDropTarget documentation to see its usage.