Visual C++ -->Accelerator Problem
When I want to use Accelerator Keystroke, I will use this :
while(1)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
if (!TranslateAccelerator(hWnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
The above code cannot get the WM_COMMAND, on the other words, it cannot do the action when keystroke
but when I use Visual C++ to generate the "HelloWorld" Example, it can work when it use this :
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
So, my question is why the first code cannot work, but the second is work
thx for help
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement