GUI ScreenIO for Windows

 ScreenIO.com


KeyState

This API checks the state of keyboard keys.  It is designed to allow the programmer to determine the state of various Lock or Toggle keys, but it will check the state of any key on the keyboard.  We only supply values in the copybook to check the state of Caps Lock, Scroll Lock, Num Lock, Insert, and the Windows Keyboard keys, Menu, and Winkeys

Client/Server issues

This API will normally check the state of keys on the keyboard of the client.  If you want to check the keyboard on the server, you can select this as follows:

     SET WIN32API-EXECUTE-API-ON-SERVER TO TRUE

Files

Files available to copy to your system:

Usage

     COPY WIN32API.
     COPY KEYSTATE.


     
* ------------------------: Call the API.

           SET KS-NUMLOCK   TO TRUE
           SET API-KEYSTATE TO TRUE
           CALL 'GSWINAPI' USING WIN32API-PARMS
                                 KEYSTATE
                                 WIN32API-B
                                 WIN32API-C
                                 WIN32API-D
                                 WIN32API-E
                                 WIN32API-F.

 

Parameters specific to this function

KEYSTATE-KEY 

This field specifies the Keyboard key you want to check.  We provide 88's for all of the following Toggle keys, of which a programmer might want to check the state in preparation to setting the state as a convenience to the user.  (For example, turning on Num Lock when a great deal of numerical values are to be entered via the numeric pad.  This is an Input field.

KS-INSERT 
KS-CAPSLOCK
KS-NUMLOCK 
KS-SCROLL 
KS-PAUSE 

These keys can aldo be checked, but the do not appear on all keyboards.  The last three refer to the windows specific keyboard keys.

KS-LALT 
KS-RALT 
KS-APPS 
KS-LWIN 
KS-RWIN 

Note:  Any other key for which you know the code (available in the copybook for SimulateKeys API) can also be checked.  However, timing of such checks is fairly exacting, and we do not believe the ability to check the status of a keyboard key is the domain of the application programmer, and we can not guarantee the synchronicity of the other keyboard keys.

KS-TOGGLE-STATE 

This field has two 88 values to indicate the toggle state of the key.  Toggle is only meaningful for Num Lock, Scroll Lock, Caps Lock and Insert mode.  This is an output field.

KS-PRESS-STATE

This field reports the Key Down or Key Up state of the specified key.  It is not necessarily meaningful for Toggle keys.  This is an output field.

WIN32API-PARMS - Used in all GSWINAPI calls

This argument is standard for all Calls to GSWINAPI. It is used to select the desired API or function, and to return the status of the operation.

WIN32API-RC

Used to return the status of a call to GSWINAPI.  A value of zero is a failure, any other value indicates success. 

The value returned, (if greater than zero) is the actual number of characters converted.

Recommended usage is to test the 88-level value WIN32API to see if it worked, then to use the text error message to see why it failed.

* ------------------------: If function failed,
*                         :   display the error in a message box.
*
     IF WIN32API-FAILED
       MOVE WIN32API-ERROR-TEXT TO panel-MESSAGE-TEXT
       SET panel-MESSAGE-IN-MESSAGEBOX TO TRUE.

WIN32API-ERROR-CODE

Error code that was returned by Windows.  This is not generally useful unless you have the Windows Platform SDK documentation available to you.

WIN32API-ERROR-TEXT

Plain-text error message that describes why the operation failed.

WIN32API-A through WIN32API-F

The number of these present varies depending on how many arguments are used by the desired function.  These are not used, but must be present because this CALL requires seven arguments.


2000-2006 Norcom, all rights reserved 

TOC

Send feedback to Norcom