This may be a stupid question, but should the arrow keys trigger a WM_KEYDOWN message? They aren't in my program, so I was wondering if that is correct behavior. Also, if it is correct then how do you usually check if they're pressed?
This may be a stupid question, but should the arrow keys trigger a WM_KEYDOWN message? They aren't in my program, so I was wondering if that is correct behavior. Also, if it is correct then how do you usually check if they're pressed?
1)That should trigger a WM_KEYDOWN message
2)You can use VK_LEFT,VK_RIGHT,etc...
check this link for a download of the win32 manual it helps ALOT
http://ftgu.thejefffiles.com/downloads.php
[edit] oh and if you get the help file check for the keyboard stuff under Processing Keystroke Messages[/edit]
Last edited by prog-bman; 06-21-2004 at 12:35 AM.
Woop?
It the application Win32 API or MFC?
Kuphryn
I was already using the Win32 API reference that came with the Platform SDK. The document you linked me to seems to be pretty much the same thing as the one I was using.Originally Posted by prog-bman
It's Win32 API.Originally Posted by kuphryn
The weird thing is, the window recieves a WM_KEYDOWN on every key that's supposed to trigger one except the arrow keys. One thing I probobly should've mentioned before is that the window that's supposed to recieve the input is actually a control inside another window. The parent window isn't recieving a WM_KEYDOWN on the arrow keys either though, so I dunno if that has anything to do with it.
Interesting.
One solution is a keyboard hook. Check out SetWindowsHook() and SetWindowsHookEx().
Kuphryn
Yup, that did the trick. Thanks for the help. It's weird that I'd have to set things up that way...
Uh, one short follow up question. Is there any way to send information into the KeyboardProc function (such as the hook handle) without using a global variable? In this case if I were to use a global variable it would cause some annoying complications.
I keep track of key presses using an bool array, just set the wParam index in the array to true on key down and false on key up..
Wery weird... well, you can check if arrow keys does not trigger WM_SYSKEYDOWN message just to be sure.Originally Posted by Xzyx987X
Ok, here are a few more details that may explain things. First of all, I tried to intercept the WM_SYSKEYDOWN message, and the only message that tripped it after I pressed every key on the entire keyboard was the alt key. Another interesting thing that I didn't notice before because my speakers were off, whenever I press a charector key when the control has focus I get the default windows beep sound. Lastly, when I had the keybord input set up to be recived through a hook process, it gave me two key presses forevery single key I typed. Anyone know what's wrong now?
Since this seems to be such a difficult problem I'll post the full source code to the control. You won't be able to compile it without the my other code libraries though, so if you really need those to tell what wrong let me know and I can post those too. Also, even though it's only about 2/3 done at this point feel free to offer feedback about ways it could be improved.