• Advertisement

Archived

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

Simple Keyboard Input

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

Guest Anonymous Poster
Its been a while since I've done this, but you can use getAsynckeystate... just the constant is something like VK_A for the 'a' key ... etc.

Share this post


Link to post
Share on other sites
Advertisement
For virtual keys, VK_A, VK_B, etc, are accurate when using the UIKeyEvent class. However, I am uncertain as to whether or not it is case sensitive... I believe it may be, as it's a direct map to the ascii 0x41 - 0x5A. Perhaps you should try hitting the capslock and seeing if that's your problem.

-fel

Share this post


Link to post
Share on other sites
Here is how you do it:

//some string variable
char name[256];

//in your winproc
int index;

switch( msg )
{
case WM_CHAR:

index = strlen( name );
name[ index ] = (char)wParam;

return FALSE;

.
.
.

Share this post


Link to post
Share on other sites
For the letter a use:

GetAsyncKeyState('A')

The variable passed must be a capital letter.
If you want to read capital and lower case you would have to read the shift key.

Good luck with your program

Share this post


Link to post
Share on other sites
Hello!
I'm using the GetAsyncKeyState(VK_***), but I can't get alphabet, only other Keyboard buttons, like Shift, or the up Button. How can I get alphabet(For example - A) without using DirectInput(I know the way with Direct Input...), and without using the WM_KEYDOWN?
Is there a way?

Share this post


Link to post
Share on other sites
If you use the WM_CHAR message, the wParam of the message contains the letter correctly capitalized. You need not worry about checking the shift and caps lock keys.

Share this post


Link to post
Share on other sites

  • Advertisement