• Advertisement

• Popular Now

• 12
• 12
• 9
• 10
• 13
• Advertisement
• Advertisement
• Advertisement

WM_KEYDOWN not working???

This topic is 3214 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, for some reason the WM_KEYDOWN only catches some keys but not others, for example it catches left, right, up, down as well as home, page up/down, end, del keys but NOTHING else. The way I'm testing it is by setting a breakpoint right after WM_KEYDOWN is cought, and examinig the wParam value. What is causing this problem? P.S I'm using an extended (extra buttons) Logitech keyboard, can this have something to do with it?

Share this post

Share on other sites
Advertisement
Can we see your code? Are you checking for upper case characters? I.e. if(wParam=='A') ...?

Share this post

Share on other sites
Quote:
 Original post by Evil SteveCan we see your code? Are you checking for upper case characters? I.e. if(wParam=='A') ...?

I'm not checking for any characters, I just break after the WM_KEYDOWN arrives then check the x variable to see which hex code it cought:

bool InputExtension::TrueOnKeyDown(int KeyID){	IEOSMessage LastMsg= m_pEngine->GetWindowManager()->GetLastMessage();	if(LastMsg.Message == WM_KEYDOWN)	{		int x = LastMsg.wParam;		int  y = x;  //just some code for the breakpoint to work		if(LastMsg.wParam == KeyID)		{						return true;		}	}	return false;}

Share this post

Share on other sites
When/where are you storing the "last" message?

If you do inside your message loop you might only get the WM_KEYDOWN message but not the WM_CHARs that are created during TranslateMessage.

Share this post

Share on other sites
@Endurion, I'm capturing LastMessage inside the WndProc. Why wuldn't this work though? I don't remember ever testing for WM_CHARs if I wanted to see if the key was pressed. Besides, then Shifts and Ctrls would also generate WM_KEYDOWN since they're not chars right?

Share this post

Share on other sites
Ah, ok, that sounds reasonable then.

What i was thinking about: If there's more than one message in the queue, last message might only give you the last of the batch, therefore skipping some.

Is this a custom HWND or a common control? If you override (subclass) a common control you may have to override WM_GETDLGCODE and return DLGC_WANTALLKEYS.

Share this post

Share on other sites
Quote:
 Original post by EndurionAh, ok, that sounds reasonable then. What i was thinking about: If there's more than one message in the queue, last message might only give you the last of the batch, therefore skipping some.Is this a custom HWND or a common control? If you override (subclass) a common control you may have to override WM_GETDLGCODE and return DLGC_WANTALLKEYS.

Yea that was exatctly it, thanks :). Now instead of having just last message a made a vector<OSMsgs> and basically push a all messages on it.

Share this post

Share on other sites

• Advertisement