Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

KEY_EVENT_RECORD (Structures)
 
.
Summary
The KEY_EVENT_RECORD structure is used to report keyboard input events in a console INPUT_RECORD structure.

C# Definition:

  [StructLayout(LayoutKind.Explicit,CharSet=CharSet.Unicode)]
  public struct KEY_EVENT_RECORD
  {
    [FieldOffset(0),MarshalAs(UnmanagedType.Bool)]
    public bool bKeyDown;
    [FieldOffset(4),MarshalAs(UnmanagedType.U2)]
    public ushort wRepeatCount;
    [FieldOffset(6),MarshalAs(UnmanagedType.U2)]
    public VirtualKeys wVirtualKeyCode;
    [FieldOffset(8),MarshalAs(UnmanagedType.U2)]
    public ushort wVirtualScanCode;
    [FieldOffset(10)]
    public char UnicodeChar;
    [FieldOffset(12),MarshalAs(UnmanagedType.U4)]
    public ControlKeyState dwControlKeyState;
  }

  // dwControlKeyState bitmask
  [Flags]
  public enum ControlKeyState
  {
    RIGHT_ALT_PRESSED = 0x1,
    LEFT_ALT_PRESSED = 0x2,
    RIGHT_CTRL_PRESSED = 0x4,
    LEFT_CTRL_PRESSED = 0x8,
    SHIFT_PRESSED = 0x10,
    NUMLOCK_ON = 0x20,
    SCROLLLOCK_ON = 0x40,
    CAPSLOCK_ON = 0x80,
    ENHANCED_KEY = 0x100
    RIGHT_ALT_PRESSED = 1,
    LEFT_ALT_PRESSED = 2,
    RIGHT_CTRL_PRESSED = 4,
    LEFT_CTRL_PRESSED = 8,
    SHIFT_PRESSED = 16,
    NUMLOCK_ON = 32,
    SCROLLLOCK_ON = 64,
    CAPSLOCK_ON = 128,
    ENHANCED_KEY = 256,
  }

VB Definition:

Structure KEY_EVENT_RECORD
   Public TODO
End Structure

Constants/Enums:

  Public Enum ControlKeyStates
    '/* dwControlKeyState bitmask */
    RIGHT_ALT_PRESSED = &H1
    LEFT_ALT_PRESSED = &H2
    RIGHT_CTRL_PRESSED = &H4
    LEFT_CTRL_PRESSED = &H8
    SHIFT_PRESSED = &H10
    NUMLOCK_ON = &H20
    SCROLLLOCK_ON = &H40
    CAPSLOCK_ON = &H80
    ENHANCED_KEY = &H100
  end enum

User-Defined Field Types:

Notes:

None.

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions