Skip to main content
GameDev.net gamedev.net
🔒 Locked

WM_KEYDOWN and WM_KEYUP

Started by wisey May 20, 2012 at 6:04 PM 2 replies 1.9k views
Original Post
wisey
wisey
I have some code that is supposed to detect when a key has been pressed and then released before it displays the correct text:

http://ideone.com/1j2Gk

I want both actions to be completed before it changes the text around.

http://ideone.com/XEulf

As you can see, i'm waiting for pressed and released bools to be set before it changes the text around. The problem is, is that it is changing the text as I press the key in, and not waiting until it has popped back out.

Its probably something really simple that i'm missing here so I thought I'd ask you guys.

--
Wisey
wisey
wisey
It looks like in main that WM_KEYUP is being fired off and the values changed even though the key hasn't been released. I working this out by commenting out the lines where the bool's are being set on a key press. If I do this the mode doesn't change.

Any idea's why WM_KEYUP is being fired as soon as the key is pressed inwards?

--
Wisey
tomalak
tomalak
You forgot a [font=courier new,courier,monospace]break[/font].
wisey
wisey

You forgot a [font=courier new,courier,monospace]break[/font].



Thanks tomalak

It works with the break.

--
Wisey

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.