C Language Development Kit/Functions/ShiftState

From OptiWiki

Jump to: navigation, search
Description shiftstate() sets or returns the state of

the shift mode. Normally the shift mode is toggled between on and off by pressing the shift key, but in some cases it can be very useful if the user can do this in the application program.

Syntax
int shiftstate(int mode);
Arguments
int mode
The following values of mode are defined:
0 Switches the shift mode off.
1 Switches the shift mode on.
-1 Returns the current state of the shift mode, without changing the shift mode.
Returns The current state of the shift mode.
Remarks None
Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    setecho( ON );
 
    while( 1 )
    {
        if( kbhit() )
        {
            gotoxy( 0, 0);
            if( shiftstate( -1 ) == 0)
            {
                printf("\fShift is on");
                shiftstate( 1 );
                resetkey();
            }
            else
            {
                printf("\fShift is off");
                shiftstate( 0 );
                resetkey();
            }
        }
        idle();
    }
}


Views
Personal tools