Files
harbour-core/contrib/hbnf/caplock.c
vszakats 9687850865 2013-03-16 02:10 UTC+0100 Viktor Szakats (harbour syenar.net)
* (all files)
    * stripped svn header
    * minor cleanups
    ; use following command to find out the history of files:
       git log
       git log --follow
       git blame
       git annotate
2013-03-16 02:11:42 +01:00

63 lines
1.5 KiB
C

/*
* Author....: Ted Means
* CIS ID....: 73067,3332
*
* This is an original work by Ted Means and is placed in the
* public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.5 01 May 1995 03:05:00 TED
* Modified typecasting to tame compiler warning.
*
* Rev 1.4 15 Jul 1993 00:12:22 GLENN
* Changed status_byte to make the function work in protected mode.
*
* Rev 1.3 15 Aug 1991 23:08:30 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.2 14 Jun 1991 19:53:38 GLENN
* Minor edit to file header
*
* Rev 1.1 27 May 1991 14:41:56 GLENN
* Added a parameter to turn CapLock on or off.
*
*
*
*/
#include "hbapigt.h"
#include "hbapiitm.h"
HB_FUNC( FT_CAPLOCK )
{
int iState = 0;
HB_GT_INFO gtInfo;
memset( &gtInfo, 0, sizeof( gtInfo ) );
hb_gtInfo( HB_GTI_KBDSHIFTS, &gtInfo );
if( gtInfo.pResult )
{
iState = hb_itemGetNI( gtInfo.pResult );
gtInfo.pNewVal = gtInfo.pResult;
gtInfo.pResult = NULL;
}
if( HB_ISLOG( 1 ) )
{
int iNewState = hb_parl( 1 ) ?
( iState | HB_GTI_KBD_CAPSLOCK ) :
( iState & ~HB_GTI_KBD_CAPSLOCK );
gtInfo.pNewVal = hb_itemPutNI( gtInfo.pNewVal, iNewState );
hb_gtInfo( HB_GTI_KBDSHIFTS, &gtInfo );
}
if( gtInfo.pNewVal )
hb_itemRelease( gtInfo.pNewVal );
if( gtInfo.pResult )
hb_itemRelease( gtInfo.pResult );
hb_retl( ( iState & HB_GTI_KBD_CAPSLOCK ) != 0 );
}