- 4.41.2.13. -
Table of Contents
4. Standard Units
4.41. Keyboard - Keyboard Handling unit
4.41.2. Keyboard Unit Procedures and Functions
4.41.2.13. TestKey function
4.41.2.13. TestKey function
Targets: MS-DOS, Win32 console
Keyboard Unit
Checks the state of a key with a given scan code.
Declaration:
function TestKey(Scan: Byte): Boolean;
Remarks:
The TestKey function returns TRUE if the key
with the given scan code is pressed, FALSE otherwise.
This function works in multi-keys mode only (see
MultikeysInit).
Example:
{$ifndef __CON__}
This program must be compiled as an MS-DOS or Win32
console application
{ $endif}
uses Keyboard;
begin
MultikeysInit;
Writeln('Press [Esc]+[Space] to exit..');
repeat (* Wait loop *)
until (TestKey(Space_Scan) and TestKey(Esc_Scan));
Writeln('Ok.');
MultikeysDone;
end.
- 4.41.2.13. -