User32GetKeyState(Int32) Method
Retrieves the status of the specified virtual key.
The status specifies whether the key is up, down, or toggled (on, off—alternating each time the key is pressed).
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", SetLastError = true)]
public static short GetKeyState(
int vKey
)
<DllImportAttribute("User32.dll", SetLastError := true>]
Public Shared Function GetKeyState (
vKey As Integer
) As Short
Dim vKey As Integer
Dim returnValue As Short
returnValue = User32.GetKeyState(vKey)
public:
[DllImportAttribute(L"User32.dll", SetLastError = true)]
static short GetKeyState(
int vKey
)
[<DllImportAttribute("User32.dll", SetLastError = true)>]
static member GetKeyState :
vKey : int -> int16
No code example is currently available or this language may not be supported.
- vKey Int32
-
The virtual-key code.
You can use left- and right-distinguishing constants to specify certain keys.
See Virtual-Key Codes:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
Int16
If the high-order bit is
1, the key is down; otherwise, it is up.
If the low-order bit is
1, the key is toggled.
A key, such as the
CAPS LOCK key, is toggled if it is turned on.
The key is off and untoggled if the low-order bit is
0.
A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.