The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down.The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter.
好像直接自己定义系统热键也可以
when a WM_SYSKEYDOWN message is translated by the TranslateMessage
function. It specifies the character code of a system character key
— that is, a character key that is pressed while the ALT key is down.The WM_SYSKEYDOWN message is posted to the window with the keyboard
focus when the user presses the F10 key (which activates the menu bar)
or holds down the ALT key and then presses another key. It also occurs
when no window currently has the keyboard focus; in this case, the
WM_SYSKEYDOWN message is sent to the active window. The window that
receives the message can distinguish between these two contexts by
checking the context code in the lParam parameter.
单文档程序中CEditView可以按 alt+某键 响应WM_SYSCHAR
但是对话框程序中的CEdit却不行。
难道和某个窗口属性有关?
PreTranslateMessage可以收到WM_SYSCHAR消息,但是仍不好使,return TRUE或者FALSE都不行。什么原因?
现在的解决方法是自己转发WM_SYSCHAR。 if( WM_SYSCHAR== pMsg->message)
{
//AfxMessageBox("PreTranslateMessage");
SendMessage(WM_SYSCHAR, pMsg->wParam, pMsg->lParam);
return TRUE;
}
WM_SYSCHAR,详细可以看下
http://msdn.microsoft.com/en-us/library/aa922034.aspx
好使了。您能说说原因吗?编辑框的WM_SYSCHAR是由向导生成,其他的WM_SYSCHAR都是手工添加的。难道是微软的疏忽?