* :--------------------------------------- * ------------------------: GetKeyState API * :--------------------------------------- * : This copybook is used for the * : GetKeyState API which can be uses to * : test the state of certain keyboard * : keys. * : * : The purpose of this API is to allow * : your program to determine the state * : ov various shift/lock keys on the * : keyboard possibly in conjuction with * : the SimulateKeys API to set the state * : of these keys. * : * : Although this routine can check the * : state of any key, we only provide 88 * : level values for the keys of interest * : for programmers wanting to control * : keyboard settings of these keys. * : To test other keys, use the values * : specified in the simkeys.cob copybook. * : * : These are the keys that this copybook * : can fetch: * : * : Insert * : Capslock * : Numlock * : Scrollock * : * : Also SemiToggles keys found on the * : windows keyboards, These remain set * : unless another key follows, in which * : case they un-set themselves. * : Menu * : Apps * : Windows Key * : * To use: * * COPY WIN32API. * COPY KEYSTATE. * * --- --- Typical call --- --- --- --- --- --- --- * * : Set the keys we want to check: * : The subscript is the sequential key * : press desired in the array * 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. * * ---------------------------------------------------------------- 01 KEYSTATE VALUE LOW-VALUES. * : 05 KEYSTATE-KEY PIC X. * * :--------------------------------------- * ------------------------: TOGGLE KEYS * :--------------------------------------- 88 KS-INSERT VALUE X'2D'. 88 KS-CAPSLOCK VALUE X'14'. 88 KS-NUMLOCK VALUE X'90'. 88 KS-SCROLL VALUE X'91'. * : Unlikely to be usefull 88 KS-PAUSE VALUE X'13'. * * : Microsoft Natural keyboard and other * : keyboards with the windows keys: * : These are semi-toggles. If turned on * : they will remain on till you send the * : key again to toggle them off, but * : if you send another key they will also * : toggle off. * : Example KS-rwin, R, notepad, enter * : will launch the note pad using the * : start button as if you pressed the * : "windows" key on the keyboard. 88 KS-LALT VALUE X'A4'. 88 KS-RALT VALUE X'A5'. 88 KS-APPS VALUE X'5D'. 88 KS-LWIN VALUE X'5B'. 88 KS-RWIN VALUE X'5C'. 05 KEYSTATE-RETURN-STATE. * 10 KS-TOGGLE-STATE PIC X. * : These are the useful values for toggle * : keys such as capslock, numlock, etc 88 KS-TOGGLED-OFF VALUE LOW-VALUES. 88 KS-TOGGLED-ON VALUE X'01'. 10 KS-PRESS-STATE PIC X. * : These are provided for completeness * : but are not meaningfull for toggle * : keys, only shift, alt, ctrl 88 KS-PRESS-OFF VALUE LOW-VALUES. 88 KS-PRESS-ON VALUE X'80'.