Jump to content
  • Advertisement

Archived

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

Jesper T

Win32, keyboard/virtual keys -problem

This topic is 5400 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

I need to convert virtual key codes into text strings, so instead of making a huge switch statement I decided to try some already existing functions: char keyName[48]; GetKeyNameText(MapVirtualKey(VK_SPACE, 0) >> 16, keyName, 48) The 16th to 23rd bit of the first parameter of GetKeyName() is the scan code, and MapVirtualKey() returns the scan code. This is the problem: GetKeyNameText returns zero (which means it has failed), and GetLastError also returns zero, which means that the last function was succesful. And nothing is added into the string. So whats going on here? any clues? [edited by - Jesper T on October 7, 2003 3:17:50 PM]

Share this post


Link to post
Share on other sites
Advertisement
Ah, yes, I read that too, but also

quote:

The function interprets the following portions of lParam:

Bits 16–23: Scan code.

Bit 24: Extended-key flag. Distinguishes some keys on an enhanced keyboard.

Bit 25: "Don't care" bit. The application calling this function sets this bit to indicate that the function should not distinguish between left and right CTRL and SHIFT keys, for example.





EDIT: NM, I found out whats wrong, I was shifting it the wrong way.. doh!

[edited by - Jesper T on October 8, 2003 6:49:29 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!