Sign in to follow this  

How to use Keyboard virtual keycodes

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

hi i got some problem by using virtual keycode, I wish to enter the "I" key , but it only tell me the "I" key value is "49", but went i put 49 to case, it didn't work. http://delphi.about.com/od/objectpascalide/l/blvkc.htm
void CALLBACK KeyboardProc( UINT nChar, bool bKeyDown, bool bAltDown )
{
    if( bKeyDown )
    {
        switch( nChar )
        {
	   //Play button and Again button shortcut key -- Enter
	   case VK_RETURN:
	   if ( Scene == IntroScene )
	   {
               PlayStart();
	   }
	   break;

	   case 49:
	   if ( Scene == IntroScene )
	   {
		g_pIntroSound->Stop();
		playInstruction(0); 
	   }
	   break;
    }
}


Share this post


Link to post
Share on other sites
The 49 as referenced on the site is a hexadecimal number, so use:

case 0x49:
break;

or even easier (what I prefer)

case 'I':
break;

Share this post


Link to post
Share on other sites

This topic is 3873 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.

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