| | |
Calling a base class implementation in MFC
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Well, this post might seem weird but as i am very much confused, i thought to seek some help from here.
My question is : When should i call a base class implementation of a message handler in my own implementation? ( I am talking about MFC.)
For example :
I have also called the base class implementation of message handler in the above code.
However, as I found, it is necessary to call in some cases and it works if i dont do so in other cases.
How do I decide this? Or its just one more thing to remember?
My question is : When should i call a base class implementation of a message handler in my own implementation? ( I am talking about MFC.)
For example :
C++ Syntax (Toggle Plain Text)
afx_msg return_type MyFrameClass::OnMessageHandler () { CFrameWnd::OnMessageHandler(); // my code }
I have also called the base class implementation of message handler in the above code.
However, as I found, it is necessary to call in some cases and it works if i dont do so in other cases.
How do I decide this? Or its just one more thing to remember?
Bhoot
I don't think there is any set rule -- depends on the message. Look at the message description in MSDN. Some say to return TRUE if you want to base class handler to be called, or FALSE if you don't. Also, in some cases you may want the base class to handle the message before you do, which is the case in the code snippet you posted. In other cases you may not want the base class to handle the message at all.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
•
•
I don't think there is any set rule -- depends on the message. Look at the message description in MSDN. Some say to return TRUE if you want to base class handler to be called, or FALSE if you don't. Also, in some cases you may want the base class to handle the message before you do, which is the case in the code snippet you posted. In other cases you may not want the base class to handle the message at all.
OK then. I will try it out.
Bhoot
![]() |
Other Threads in the C++ Forum
- Previous Thread: Base converter
- Next Thread: "redeclared as different symbol" yet this is not the case in the code?
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






