Advertisement

MFC question....

Started by April 04, 2000 08:38 AM
0 comments, last by Rene 24 years, 8 months ago
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.

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]);
);
}
// CHRIS [win32mfc]

This topic is closed to new replies.

Advertisement