• Advertisement
Sign in to follow this  

keyboard input

This topic is 4923 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 read keypresses for my game when inputing the players name, and I dont know how to do it in windows.
FAR PASCAL cApp::MsgProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	Mouse.UpdateButtons(msg);


	switch (msg)
	{
		//Key Pressed
		case WM_KEYDOWN: 
		{
        	  playername[location]=wparam;
		}break;

	}
	return DefWindowProc(hwnd,msg,wparam,lparam);
}


when doing it this way, all the keys are in upper case, and there is no lower case I thought there was a command like GETANSIKEY or somthing that sounded like that. Anyone know how to do this in Windows? EDIT: Can anyone tell me how to do source tags? EDIT: Ok, got source tags in, thanks [Edited by - SelethD on September 3, 2004 10:03:14 PM]

Share this post


Link to post
Share on other sites
Advertisement
you use GetAsyncKeyState(VK_(the key you want in all caps)) this isnt a bool value but rather a 1 or 0 thing so youll have to do something like
if ((VK_LEFT) < 0)

{
//do something crazy
};

hope i helped

i think by source tags you mean

[ source ]
[ /source ]

with no spaces in those boxes (i think thats what you mean)

Share this post


Link to post
Share on other sites
Ok, so im not going to be able to use GetAsyncKeyState for what I need.

So I guess I need a way to convert the 'wparam' value into an ascii value.

Any way to do that?

Share this post


Link to post
Share on other sites
Yeah!!! it worked

I replaced the WM_KEYDOWN
with a WM_CHAR and it works perfectly

Thanks so much!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement