Pressing F10 pause main loop?

Started by
14 comments, last by Cocalola 10 years, 10 months ago

Solved: Just add those 2 lines and it's gonna be fine.

while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
return FALSE;

if(msg.message == WM_SYSKEYDOWN && msg.wParam == VK_F10)
continue;


TranslateMessage(&msg);
DispatchMessage(&msg);

}

Advertisement

I find this fix very strange. There has to be a better way. Maybe some flags in dwStyle when calling CreateWindowEx(...), but now my minimize button is gone...


dwStyle = WS_OVERLAPPEDWINDOW&~WS_THICKFRAME&~WS_MAXIMIZEBOX&~WS_SYSMENU;

Well, it just bypass the calls to dispatch and translate message so it's like the key was never pressed for the application (WndProc don't get called).

I admit it's a bit ugly but it could easily be fixed by adding the code in a simple function.

ex:

bool IsF10KeydownMsg(MSG msg)
{
return (msg.message == WM_SYSKEYDOWN && msg.wParam == VK_F10);
}

Or whatever suit your need.

Maybe there is another way, but i don't know it. This work just fine imo.

Huh, can't you just handle WM_SYSKEYDOWN normally in the window procedure? That surely is a better idea? =|

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

Huh, can't you just handle WM_SYSKEYDOWN normally in the window procedure? That surely is a better idea? =|

Handle in what way? By not returning DefWindowProc(hWnd, message, wParam, lParam); on the message? I think that causes errors further down the road if data is laying around not being fully processed.

Is Vortez a good programmer ?

This topic is closed to new replies.

Advertisement