This example sets the current state of the Num Lock key to on, and reports whether the state has been changed.
if ( SetKeyState( "N", true ) ) Debug.trace( "Num Lock is now ON\n" );else Debug.trace( "Num Lock was already on\n" );