Home > Software engineering > In the [WCE7] PreTranslateMessage doModal after open the window, PostMessage won't receive it o
In the [WCE7] PreTranslateMessage doModal after open the window, PostMessage won't receive it o
Time:09-22
RT: Program has a background thread, matrix keyboard scanning, and according to the CWnd * dlgCurrent, keystroke messages sent : : PostMessage (dlgCurrent - & gt; M_hwnd,... )
In the main window and the child window (in the Menu window) defines PreTranslateMessage news, Main form initialization time dlgCurrent=this,
After running the program, main form can receive the corresponding key information, In one of the key message is open the child form Case MYKEY_MENU: CMYMenu * dlgMenu=new CMYMenu (); DlgCurrent=dlgMenu; DlgMenu. DoModal (); DlgCurrent=this; .
Just open the Menu window, keyboard keys all news,
Don't do any operation, about 5 minutes later, the Menu window will not receive any news of the PostMessage anymore,,,,
Through the alignment: Normal background keyboard scanning thread send PostMessage dlgCurrent data (window pointer what of, is pointing at the Menu window, before and after contrast). The Menu window display properly; Menu window destructor added a piece of code and breakpoints, no interruption occurred; Main form in case PreTranslateMessage MYKEY_MENU branch to open the menu window is added before and after the breakpoint, no abnormal exit,
Why? The message the breakdown? How to troubleshoot the problem?
CodePudding user response:
Search "GDI leak detection"?
CodePudding user response:
See if PostMessage success? The PostMessage parameters TRACE out to observe the changes of news
CodePudding user response:
Handle to the window and also a print, see there are any changes window handle
CodePudding user response:
"Program have a background thread, matrix keyboard scanning" Upload code?