Archived

This topic is now archived and is closed to further replies.

Revelations

Win32 API keycode(I think?)

Recommended Posts

I''ve been looking, for the past 2 days, for the hex keycode in the Win32 API for "d". Mind you not "D" which is &H44, I need lower case. API viewer says nothing about this, and neither does MSDN, so, can anyone help me out?

Share this post


Link to post
Share on other sites
In AScii "d" is 100, but converted to hex that comes out as numpad 4 in win32 API. I might end up having to trap a "d" and save that as a constant on form load, but thats a nasty hack, I wanna know if there is a cleaner way?

Share this post


Link to post
Share on other sites
I did a manual check of the shift and capslock status in code, and still got a capitol D out, with VK_D, which I have been using. This surprises me, you''d think Microsoft of all companies would put a reference somewhere for this, but I am still unable to find anything about it. Any more suggestions?

Share this post


Link to post
Share on other sites
What do you mean ''it comes out as numpad 4''? Comes out from what?



"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan

Share this post


Link to post
Share on other sites
Lower case "d" doesn''t have a key code.

Lower case "d" is *TWO* keys - i.e. caps lock & "D" or shift & "D". With characters that have accents, umlauts and the like it can actually be THREE key presses. With IME it could be multiple key presses.

If this is for input, simply handle the WM_CHAR window message. With the relevent TranslateMessage() call in your message pump - that will give you the ASCII key value and automatically turn all the multiple key presses into a single [translated] ASCII (or UNICODE) value for you.

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Share this post


Link to post
Share on other sites
Yes, I am using VB ;op and Thank you S1CA, I think that will work well. I am using this to make a simple hotkey app, save myself the pain of pressing all these keys as fast as I can hundreds of times by pressing my hotkey instead. So it is sending to another app not of my making. Had I had access to the source for this I would have just made an allowance for "D" instead of "d" and been done with it. Anyways, thanks for all the help everyone ;o)

Share this post


Link to post
Share on other sites