VKD_Define_Hot_Key

include vkd.inc

VxDcall VKD_Define_Hot_Key


The VKD_Define_Hot_Key service defines a hot-key-notification callback procedure. Hot keys are detected by ANDing the shift state mask with the global shift state, then comparing the resulting state with the shift state compare value. If this matches and the key code matches, the callback procedure is called with the specified reference data in EDX.

Parameters

AL

Specifies scan code of the main key.

AH

Specifies the type of scan code. This parameter can be one of the following values:

Value Meaning

0 Normal code
1 Extended code (ExtendedKey_B)
0FFh Either normal or extended (AllowExtended_B)

EBX

Specifies shift state. The high word is a mask that is ANDed with the global shift state when checking for this hot key. The low word is the masked-shift-state-compare value.

CL

Specifies the operation flags. This parameter can be one of the following values:

Value Meaning

CallOnAll Calls on press, release, and repeats of hot keys.
CallOnComplete Calls callback when the hot key state is ended (all shift modifier keys are released), or when a different hot key is entered. For example, assume that both ALT+1 and ALT+2 are hot keys. If the user holds the ALT key down, then presses and releases the 1 key and presses the 2 key, the callback for ALT+1 is called even though the ALT key has not been released.
CallOnPress Calls callback when key press is detected.
CallOnRelease Calls callback when key release is detected. Keyboard may still be in hot-key hold state.
CallOnRepeat Calls callback when repeated press is detected.
CallOnUpDwn Calls on both press and release of hot keys.
Local_Key Specifies that the key can be locally enabled or disabled.
PriorityNotify Specifies that the callback can only be called when interrupts are enabled and the critical section is not owned. This value can be combined with any other value in this list.

ESI

Points to the callback procedure. For more information about the callback procedure, see the following “Comments” section.

EDX

Points to the reference data to pass to the callback procedure.

EDI

Specifies maximum notification delay in milliseconds if the CL register specifies the PriorityNotify value. If this parameter is zero, the callback is always notified.

Return Value

If the carry flag is clear, the EAX register contains the definition handle. Otherwise, the carry flag is set to indicate an error.

Comments

The callback procedure is called when a hot key is detected, and detection meets mask requirements. The callback receives the following input parameters:

AL ; scan code of key

AH ; 0 if key just pressed (Hot_Key_Pressed)

; 1 if key just released (Hot_Key_Released)

; 2 if key is an auto-repeat press (Hot_Key_Repeated)

; 3 hot key state ended (Hot_Key_Completed)

EBX ; hot key handle

ECX ; global shift state

EDX ; points to the reference data

EDI ; elapsed time for delayed notification in milliseconds

The EDI register normally contains zero, but if the PriorityNotify value is specified this value could be larger.

The high bit of the AH register is set if the hot key is a priority hot key, and the virtual machine which had the keyboard focus at the time the hot key was recognized was suspended or not executable. In this case, the priority event was scheduled for the system virtual machine rather than the keyboard owner. The Hot_Key_SysVM_Notify value can be used to check this bit.

The callback procedure can modify EAX, EBX, ECX, EDX, ESI, EDI, and Flags

Uses

Flags