Direct Input: Buffered Data

Started by
2 comments, last by Negitivefrags 20 years, 8 months ago
Untill this point I have been using GetDeviceState to get the keyboard state and checking against any of the device constants that Direct Input surplys. But now I want to get the user to input some actual text so I thought I would switch to Buffered input for this phase. It is easy enough to get how it works, but there is one thing I still dont get. How can you turn the information you get from the buffer into a char without cheacking manualy against every single keyboard device constant? There Must be a way! But I cant work it out, or there is somthing I am missing here.
Advertisement
To handle text input, I just rely on WM_CHAR messages. It's not like the user needs to type the text blinding fast ala DirectInput. I tried making an input class that used DirectInput, but fell back on WM_* messages when it wasn't installed, but.. it didn't work very well. I couldn't figure out how to translate the DIK_* constants to VK_* constants. There were all these articles about using several windows functions to map them, but I never understood them.

EDIT: found the link: DirectInput: Converting Scan Codes to ASCII

[edited by - psykr on August 13, 2003 6:46:26 PM]
I agree... Use WM_ messages to handle keyboard input for text manipulation, and use DirectInput for applications where you need key down operations
So you are saying that when it gets to the point where the user needs to input text I should unaquire the keyboard and then re-acquire it afterwards.. hmm.. It doesnt sound like the most elegant solution though. Im shure there must a be a reasonably simple way of converting that char[256] buffer down into a single valid char...

This topic is closed to new replies.

Advertisement