在WIN32程序中:自己写的一个函数ProcessMessage(MSG*msg);while (GetMessage(&msgMsg, NULL, 0, 0))
{
if (ProcessMessage(&msgMsg) == FALSE)
{
TranslateMessage(&msgMsg);
DispatchMessage(&msgMsg);
}
}请问在MFC 对话框 中怎么实现相同功能,也就是能够所有消息都先通过ProcessMessage()的检查,然后解析并分发消息。我重载了PreTranslateMessage(),好象不行,得不到我想要的消息。
{
if (ProcessMessage(&msgMsg) == FALSE)
{
TranslateMessage(&msgMsg);
DispatchMessage(&msgMsg);
}
}请问在MFC 对话框 中怎么实现相同功能,也就是能够所有消息都先通过ProcessMessage()的检查,然后解析并分发消息。我重载了PreTranslateMessage(),好象不行,得不到我想要的消息。
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN){
if (pMsg->wParam == VK_A)
AfxMessageBox("a");
}
return CDialog::PreTranslateMessage(pMsg);
}
在CPP文件里面定义消息,在.H文件里面定义消息处理函数就好了
ON_MESSAGE()