Sign in to follow this  
Eralp

Upper/Lowercase problem

Recommended Posts

Hi, after reading few writings about the lacks of dinput, I changed my inputsystem now it uses win32 messages, but wparam variable only holds uppercase letters, how do you get the 'right' case? here is my code if this helps..
	switch(message)
    {
 		case WM_KEYDOWN:							
		{
			if(keys[wParam] == FALSE)
			{
				keys[wParam] = TRUE;
				KeyPress(wParam);
			}									
		}break;
		case WM_KEYUP:								
		{
			keys[wParam] = FALSE;									
		}break;
    }


/*******************************************/

void ERGUI::KeyPress(WPARAM Pressed)
{
switch(Pressed)
{
case 'a':
menejerim.AddButton(100,200,440,200,"hehhe",butonsprite,foo);
	break;
case 'A':
menejerim.AddButton(300,200,440,200,"HEHHE",butonsprite,foo);
	break;
}	
}


Share this post


Link to post
Share on other sites
Key presses are not the same as text. When the 'F' key is pressed, that could type either a lowercase f or an uppercase F... or it could open a 'find' dialog, or pop up the file menu, depending on the modifier keys. Meanwhile, if you hold the 'F' key down, it may continue to type more f's, although it hasn't been re-pressed.

the WM_CHAR messages are sent to indicate text that is typed. The WM_KEYDOWN messages are sent to indicate keys that have just been pushed down. If you want to get some text, use the WM_CHAR messages. If you want to treat 'a' and 'shift-a' like commands, then (a) you should probably make that 'ctrl-a' and 'shift-ctrl-a' instead; and (b) you will need to check for yourself what modifier keys are down. (You can, for example, have a flag for the shift key, that you set when you get a WM_KEYDOWN for shift, and clear when you get a WM_KEYUP for it.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this