Handmade Hero»Forums
6 posts
KEY_UP/DOWN notifications triggering MainWindowCallback when they shouldn't

I've hit day 16 and 17 of the series where Casey sets up the unified input and moves the PeekMessage call to his own function. I run into the issue where everything works but if I assert that UP/DOWN messages don't enter the main callback, the assert triggers. I'm not sure if this is a difference between back then and now (windows 10) or if it's even really an issue.

Is this really a breaking issue or just something I should keep in mind moving forward? From what I've looked up I don't see a way to deny windows from using the callback for key presses.

Simon Anciaux
1241 posts
KEY_UP/DOWN notifications triggering MainWindowCallback when they shouldn't

There shouldn't be a difference between windows 7 and 10 in message handling. What is causing the WindowProc to be called is if you call DispatchMessage on the message you retrieved with PeekMessage or GetMessage.

So check if you call DispatchMessage after processing your keyboard messages and if you do, remove it. Otherwise you'll need to share your code for us to look at.

You still need to call TranslateMessage though.

6 posts
KEY_UP/DOWN notifications triggering MainWindowCallback when they shouldn't
Edited by baublebeard on

That was it! Dispatch message was in the wrong spot. Thank you for the quick reply.