home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / NFSRC305.ZIP / C / CAPLOCK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-01  |  2.0 KB  |  76 lines

  1. /*
  2.  * File......: CAPLOCK.C
  3.  * Author....: Ted Means
  4.  * CIS ID....: 73067,3332
  5.  *
  6.  * This is an original work by Ted Means and is placed in the
  7.  * public domain.
  8.  *
  9.  * Modification history:
  10.  * ---------------------
  11.  *
  12.  *    Rev 1.5   01 May 1995 03:05:00   TED
  13.  * Modified typecasting to tame compiler warning.
  14.  *
  15.  *    Rev 1.4   15 Jul 1993 00:12:22   GLENN
  16.  * Changed status_byte to make the function work in protected mode.
  17.  *
  18.  *    Rev 1.3   15 Aug 1991 23:08:30   GLENN
  19.  * Forest Belt proofread/edited/cleaned up doc
  20.  *
  21.  *    Rev 1.2   14 Jun 1991 19:53:38   GLENN
  22.  * Minor edit to file header
  23.  *
  24.  *    Rev 1.1   27 May 1991 14:41:56   GLENN
  25.  * Added a parameter to turn CapLock on or off.
  26.  *
  27.  *
  28.  *
  29.  */
  30.  
  31.  
  32. /*  $DOC$
  33.  *  $FUNCNAME$
  34.  *     FT_CAPLOCK()
  35.  *  $CATEGORY$
  36.  *     Keyboard/Mouse
  37.  *  $ONELINER$
  38.  *     Determine and optionally change the status of CapLock key
  39.  *  $SYNTAX$
  40.  *     FT_CAPLOCK([ <lNewSetting> ]) -> lCurrentSetting
  41.  *  $ARGUMENTS$
  42.  *     <lNewSetting> is optional and if supplied is the new setting
  43.  *     for the CapLock key.  Specify .T. to turn CapLock on, or .F. to
  44.  *     turn it off.
  45.  *  $RETURNS$
  46.  *     .T. if CapLock is set, .F. if it isn't set.  The value returned
  47.  *      represents the setting in effect prior to any changes that might
  48.  *      by made by <lNewSetting>.
  49.  *  $DESCRIPTION$
  50.  *     This function is useful if you need to know or set the status of the
  51.  *     CapLock key for some reason.
  52.  *  $EXAMPLES$
  53.  *     IF FT_CAPLOCK()
  54.  *        Qout( "CapLock is active" )
  55.  *     ENDIF
  56.  *  $SEEALSO$
  57.  *     FT_ALT() FT_CTRL() FT_NUMLOCK() FT_PRTSCR() FT_SHIFT()
  58.  *  $END$
  59.  */
  60.  
  61. #include <EXTEND.API>
  62.  
  63. #define status_byte ( *( unsigned char * ) ( 0x00400017 ) )
  64.  
  65. CLIPPER FT_CAPLOCK(void)
  66. {
  67.    _retl( ( int ) ( status_byte & 0x40 ) );
  68.  
  69.    if ( PCOUNT )
  70.       if ( _parl( 1 ) )
  71.          status_byte = ( status_byte | ( unsigned char ) 0x40 );
  72.       else
  73.          status_byte = ( status_byte & ( unsigned char ) 0xBF );
  74.  
  75.    return;
  76. }