Hi,
Is there a function for catching messages before TranslateMessage. There is one for MFC, it is "PreTranslateMessage". Without this, is a terrible to catching virtual functions via WM_KEYDOWN (If a dialog has controls).
Thanks for advance
Hi,
Is there a function for catching messages before TranslateMessage. There is one for MFC, it is "PreTranslateMessage". Without this, is a terrible to catching virtual functions via WM_KEYDOWN (If a dialog has controls).
Thanks for advance
Are you referring to PeekMessage() ?
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
All that PreTranslateMessage stuff is because you dont have direct access to the message loop in MFC....it gives you a chance to manipulate the messages before the API function TranslateMessage() gets to them
As you need to create this message loop yourself when you create an app "SDK style", you just enter the code you want to use before you call TranslateMessage() on each iteration of the loop
Hi,
Thanks to everybody. I attached an example for catching virtual keys on Dialog Based Applications. But not finished yet. Now I'm too tired and wanted to ask others(~ 4:00 a.m). In fact, I know there are questions about this subject here. I tried to do this but failed to catching mouse clicks. Keyboard keys are not give satisfaction too. I know how to do this via accelerator keys but I don't want to use it. After finished suppose will be useful for some other novice coders too. Whatever, I am making a mistake somewhere.
Replaying;
1. How can I catch mouse clicks
2. How can this message circle can be better.
Hope somebody makes clear. Any idea? Suggestion? Example?
oops! Can not attach. Here is message circle;
...
hwnd=CreateDialog(hInst, (LPCTSTR)ID_DIALOG, NULL, (DLGPROC) DialogFunc);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(TRUE)
{
if(PeekMessage (&Msg, NULL, 0, 0, PM_REMOVE))
{
if (Msg.message == WM_QUIT)
break ;
else
{
if (Msg.message == WM_KEYDOWN || Msg.message == WM_LBUTTONDOWN)
{
if(Msg.wParam==VK_END)
Msg.wParam=VK_TAB;
if(!IsDialogMessage(hwnd,&Msg))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
}// els
}
}
return Msg.wParam;
...