Sign in to follow this  
VanillaSnake21

WM_KEYDOWN not working???

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


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Can 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


Link to 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


Link to 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


Link to post
Share on other sites
Quote:
Original post by Endurion
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.


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


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this