ASYNCKEYSTATE property (System)
Description
Returns the state of a key at the time the property is accessed. The key to check is passed as a virtual-key code in the index parameter.
Property Value
This property is an integer value that represents a set of bit flags. As a general rule:
• If the key is pressed down the property returns a value < 0.
• If the key is not pressed 0 is returned.
• If the key is not pressed but has been since the last ASYNCKEYSTATE call, then 1 is returned.
See remarks for more information.
Property Traits
Development | Runtime | Indexed | Scaled | Synthetic |
---|---|---|---|---|
N/A | Get | Yes | No | No |
Remarks
This property is essentially a wrapper around the GetAsyncKeyState Windows API function, so please refer to the documentation on the Microsoft website for further information, especially regarding some caveats regarding the value returned.
Virtual-key code constants are defined in the MSWin_VirtualKey_Equates insert record.
Example
// Get the state of the Shift key $Insert MSWin_VirtualKey_Equates ShiftDown = ( Get_Property( "SYSTEM", "ASYNCKEYSTATE", VK_SHIFT$ ) < 0 )
See Also
KEYSTATE property