How VC6 makes dialog respond to WM_ Char message
The solution is to override the function PreTranslateMessage, which does the processing and sets the focus on the main window.
The specific code is as follows.
BOOLCMfcDlgMainDlg::PreTranslateMessage(MSG*pMsg)
{
if(WM_KEYDOWN==pMsg->message||WM_CHAR==pMsg->message)
{
pMsg->hwnd=m_hWnd;
returnFALSE;
}
returnCDialog::PreTranslateMessage(pMsg);
}
Similar Posts:
- [Solved] Warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
- Solve the problem of destroying windows caused by multiple attchs of control classes in MFC. CWnd * pWnd = CWnd:: fromhandlepermanent (hWnd); ASSERT(pWnd != NULL); Assertion failure problem
- How to Solve vuetify dialog box cannot be edited (The embedded tinymic component)
- deprecated conversion from string constant to char*
- assignment makes pointer from integer without a…
- Can’t create handler inside thread that has not called Looper.prepare()
- MySQL: invisible empty symbol char (9) char (10) char (13)
- The whole program exits when [QT] qmessagebox is closed
- The Difference between $(document).ready, window.onload and $(window).load(function (){})
- How to Solve Const variable assignment Error