Archived

This topic is now archived and is closed to further replies.

Rene

MFC question....

Recommended Posts

Why isnt my message handlers executed when i add them to the class CMainFrame, but when i add them to CMyView they are executed perfectly. I have used the classwizard to do this.

Share this post


Link to post
Share on other sites

You need to provide more information.. What message are you trying to handle? Make sure you are not handling it already in the view class; and see if the view class doesn''t do some sort of default handling (thus, it never gets forwarded to the CMainFrame class.)

A decidedly inelegant hack is to create a handler function in CMainFrame and handle the message in your view class like this:

LRESULT CYouViewClass::MessageHandler([PARAMETERS])
{
return (
((CMainFrame*) AfxGetApp()->m_pMainWnd)->MessageHandler([PARAMETERS]);
);
}

Share this post


Link to post
Share on other sites