PreTranslateMessage or Message Maps in CWinAp derived classes
Posted on 2003-03-31
I'm currently trying to sort out some historic code which has something like this:
BOOL CMyWinApp2::PreTranslateMessage(MSG* pMsg)
if (pMsg->message == WM_DRIVER_FIRSTNOTE)
WM_DRIVER_FIRSTNOTE is a custom registered windows message.
CMyWinApp2 is derived from a class (CMyWinApp1) that is derived from CWinApp. All the inheritance seems fine.
There is also a message map for WM_DRIVER_FIRSTNOTE:
The prototype for OnFirstNote is:
afx_msg LRESULT OnFirstNote(WPARAM, LPARAM);
The message in question originates from a list control on a property page on a modal dialog. The property sheet and the dialog both have the 'No parent notify' option disabled in the resource, if that's of significance. I assume that option would if enabled stop the message being passed back to the app?
An now for my question:
As I understand it PreTranslateMessage is not the correct way to map messages like this. (I'm not bothered about disputing this, there are several topics out there to support my claim, unless someone truely knows what they're talking about). Given this when I remove the PreTranslateMessage it doesn't call OnFirstNote?!? The message isn't handled anywhere else apart from in the main ap code, and as I understand it, it should get passed to my CMyWinApp2 class and map to OnFirstNote.
What am I missing/not understanding correctly?