DirectX SDK

DIKEYBOARDSTATE

The DIKEYBOARDSTATE type contains information about the state of keyboard keys. This type is used with the DirectInputDevice.GetDeviceStateKeyboard method.

Type DIKEYBOARDSTATE
    key(0 To 255) As Byte
End Type

Members

key
Array of key states. The array can be indexed by using members of the CONST_DIKEYFLAGS enumeration. For each key, the high bit is set if the key is down, and clear if the key is up or does not exist.

Remarks

The following example checks to see if the Esc key is being pressed:

Dim keyState as DIKEYBOARDSTATE
' diDevice is a valid DirectInputDevice object.
 
Call diDevice.GetDeviceStateKeyboard(keyState)
If (keyState.key(DIK_ESCAPE) And &H80) Then
    ' Key is down
End If