Http://topic.csdn.net/u/20070828/17/a4283e65-6176-4673-8559-5e822667b4d3.html
1:
In MFC, pretranslatemessage is getmessage (...) next-level operation of the function, that is, getmessage (...) after obtaining a message from a message queue, it is processed by pretranslatemessage (). If false is returned, it is processed by translatemessage and dispatchmessage (entering windowproc );
If sendmessage is used, the message is directly delivered to windowproc for processing. Therefore, getmessage does not obtain the sendmessage message. Of course, pretranslatemessage will not be called.
If postmessage is used, the message enters the message queue and is obtained by getmessage. pretranslatemessage has the opportunity to process the message.
2:
Sendmessage must be differentiated from the environment. If it is the sendmessage window of the current thread, windowproc is called directly without passing through any message loop or putting it into the message queue. Therefore, neither getmessage nor pretranslatemessage can be captured; if sendmessage is sent to a window of another thread or other processes, the message enters the message queue. getmessage and pretranslatemessage can capture this message .??? Realy ???
Summary:
Not all messages pass through pretranslatemessage ()
For example, you can use sendmessage () to send messages to this form. directly enter windowproc.
For example, none of my pagepower pretranslatemessage () messages can be received !!!
After trying, The pretranslatemessage () in maindlg cannot receive any message. It seems that it is because of the problem of using MFC to expand the DLL in Win32.
Because a thread has only one message queue, there is only one translatemessage () and dispatch. In general, there are many windowproc, and one window corresponds to one windowproc.
Not all messages pass through windowproc ()
For example, if the window contains a subwindow, if you move the mouse over the subwindow, the message is directly distributed to the subwindow windowproc () in pretranslatemessage ().