home *** CD-ROM | disk | FTP | other *** search
- KEYUTILS
-
- The file KEYUTILS.ARC contains three useful utilities -
- SETKEY, RESETKEY and READKEY - and assembly language source
- code. The program KEYDISP is included to demonstrate the use
- of READKEY.
-
- ------------------------------------------------------------
- SETKEY
-
- This utility defines the functions keys 1-40.
-
- Syntax: SETKEY n text
-
- Where: n - is a number between 1 and 40, inclusive.
- text - is the text to be associated with the
- function key.
-
- Ex 1: setkey 1 dir
-
- Results: The command DIR is executed when F1 is pressed.
-
- Ex 2: setkey 12 golotus
-
- Results: Executes the command GOLOTUS when the Shift-F2
- key is pressed.
-
-
- REQUIREMENTS: The SETKEY command requires the ANSI.SYS
- driver to be installed. The ESC sequence identifying
- the key is added before "text" and a carriage return
- is added afterwards.
-
- Advanced feature: A sequence of commands can be assigned to
- a single key by adding the following between commands:
-
- ";13;"
-
- Note: The quotes are required.
-
- Ex. 3: setkey 24 cls";13;"dir
-
- Results: The screen is cleared and the DIR command executed
- when the CTRL-F4 key is hit.
-
- Hints: Assign keys that are used little (11 - 40) by other
- applications. For example, almost all programs use the F1-F10
- keys, but few use the SHIFT, CTRL, ALT form of these keys.
-
- -------------------------------------------------------------
- RESETKEY
-
- This utility resets the function keys to there previous
- state.
-
- Syntax: RESETKEY n
-
- Where: n - is a number between 1 and 40, inclusive.
-
- Ex. 1: resetkey 1
-
- Results: Resets F1 to previous setting.
-
- Requirements: ANSI.SYS must be installed to function
- properly.
- ------------------------------------------------------------
- READKEY
-
- READKEY is a subroutine which can be modified for Pascal,
- C, Basic, etc. This program reads a key from the keyboard and
- returns its value in AX. If the key entered is an extended
- key, then the value in AX represents the scan code plus 1000.
- If the key was entered by holding the ALT key and entering the
- ascii code from the keypad, then 2000 is added to ascii code.
-
- Ex. 1: If the letter "a" is entered from the keyboard, then
- READKEY returns the value 97 in AX.
-
- Ex. 2: If the PgDn key is entered from the keyboard, then
- READKEY returns the value 1081 in AX.
-
- Ex. 3: If the ALT-127 is entered, then 2127 is returned in
- AX.
-
- This makes it easier for a programmer to identify keys as
- one code rather than a combination of two codes - the ascii 0
- followed by the scan code. For example, the PgDn key produces
- an ascii 0 and 81 (0,"Q") sequence. It also makes it possible
- to distinguish between a code entered normally and those
- entered by the combination ALT key and keypad.
- The program KEYDISP displays the codes returned by
- READKEY. Hitting the space bar will terminate the program.
-