CRT Documentation: Reference

GetControlKeyState

[This function does not have a corresponding DOS function.]

Returns the status of the Control keys.

function GetControlKeyState: longword;

Parameters

This function has no parameters.

Return Values

This function returns a bit-mask of the control key state of the last ReadKey call.

Value Meaning
RIGHT_ALT_PRESSED Right Alt key was pressed.
LEFT_ALT_PRESSED Left Alt key was pressed.
ALT_PRESSED One of the Alt keys was pressed.
RIGHT_CTRL_PRESSED Right Ctrl key was pressed.
LEFT_CTRL_PRESSED Left Ctrl key was pressed.
CTRL_PRESSED One of the Ctrl keys was pressed.
SHIFT_PRESSED One of the Shift keys was pressed.
NUMLOCK_ON The NumLock light was on.
SCROLLLOCK_ON The ScrollLock light was on.
CAPSLOCK_ON The CapsLock light was on.
ENHANCED_KEY The key was enhanced.

Remarks

This function uses the last state as retrieved with the last ReadKey call, it does not check the current status. This makes it easier to trap specific key combinations since you can reliably check whether a specific key combination was made. This function returns the value of the dwControlKeyState for the INPUT_RECORD returned via the Win32 API. Any changes made in this functionality will be reflected with this function.

See Also

Crt Overview, ReadKey