home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / nfpat8.zip / CAPLOCK.C < prev    next >
C/C++ Source or Header  |  1993-07-15  |  2KB  |  78 lines

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