Calling a base class implementation in MFC

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 52
Reputation: Bhoot is an unknown quantity at this point 
Solved Threads: 1
Bhoot's Avatar
Bhoot Bhoot is offline Offline
Junior Poster in Training

Calling a base class implementation in MFC

 
0
  #1
Nov 1st, 2008
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 :
  1.  
  2. afx_msg return_type MyFrameClass::OnMessageHandler ()
  3. {
  4. CFrameWnd::OnMessageHandler();
  5. // my code
  6. }

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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,406
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Calling a base class implementation in MFC

 
0
  #2
Nov 1st, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 52
Reputation: Bhoot is an unknown quantity at this point 
Solved Threads: 1
Bhoot's Avatar
Bhoot Bhoot is offline Offline
Junior Poster in Training

Re: Calling a base class implementation in MFC

 
0
  #3
Nov 2nd, 2008
Originally Posted by Ancient Dragon View Post
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.
You mean that its all the matter of remembering the handlers of which the base implementations are required to be called. And for the rest, its upon me whether to call or not. right?
OK then. I will try it out.
Bhoot
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC