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

INPUT_RECORD (Structures)
 
.
Summary
Used to report input events in the console input buffer

C# Definition:

    [StructLayout(LayoutKind.Explicit)]
    public struct INPUT_RECORD
    {
        [FieldOffset(0)]
        public ushort EventType;
        [FieldOffset(4)]
        [FieldOffset(2)]
        public KEY_EVENT_RECORD KeyEvent;
        [FieldOffset(4)]
        [FieldOffset(2)]
        public MOUSE_EVENT_RECORD MouseEvent;
        [FieldOffset(4)]
        [FieldOffset(2)]
        public WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
        [FieldOffset(4)]
        [FieldOffset(2)]
        public MENU_EVENT_RECORD MenuEvent;
        [FieldOffset(4)]
        [FieldOffset(2)]
        public FOCUS_EVENT_RECORD FocusEvent;
    };

C# Definition:

    // Helper structure to represent the union and guarantee the correct alignment for
    // both 32-bit and 64-bit Windows.
    [StructLayout(LayoutKind.Explicit)]
    public struct INPUT_RECORD_UNION
    {
        [FieldOffset(0)]
        public KEY_EVENT_RECORD KeyEvent;
        [FieldOffset(0)]
        public MOUSE_EVENT_RECORD MouseEvent;
        [FieldOffset(0)]
        public WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
        [FieldOffset(0)]
        public MENU_EVENT_RECORD MenuEvent;
        [FieldOffset(0)]
        public FOCUS_EVENT_RECORD FocusEvent;
    };

    [StructLayout(LayoutKind.Sequential)]
    public struct INPUT_RECORD
    {
        public ushort EventType;
        public INPUT_RECORD_UNION Event;
    };

VB Definition:

    <StructLayout(LayoutKind.Explicit)> _
    Public Structure INPUT_RECORD
        <FieldOffset(0)> Public EventType As System.UInt16
        <FieldOffset(4)> Public KeyEvent As KEY_EVENT_RECORD
        <FieldOffset(4)> Public MouseEvent As MOUSE_EVENT_RECORD
        <FieldOffset(4)> Public WindowBufferSizeEvent As WINDOW_BUFFER_SIZE_RECORD
        <FieldOffset(4)> Public MenuEvent As MENU_EVENT_RECORD
        <FieldOffset(4)> Public FocusEvent As FOCUS_EVENT_RECORD
    End Structure
  <StructLayout(LayoutKind.Explicit)> _
  Public Structure INPUT_RECORD
    <FieldOffset(0)> Public EventType As System.UInt16
    <FieldOffset(4)> Public KeyEvent As KEY_EVENT_RECORD
    <FieldOffset(4)> Public MouseEvent As MOUSE_EVENT_RECORD
    <FieldOffset(4)> Public WindowBufferSizeEvent As WINDOW_BUFFER_SIZE_RECORD
    <FieldOffset(4)> Public MenuEvent As MENU_EVENT_RECORD
    <FieldOffset(4)> Public FocusEvent As FOCUS_EVENT_RECORD
  End Structure

VB Definition:

    ' Helper structure to represent the union and guarantee the correct alignment for
    ' both 32-bit and 64-bit Windows.
    <StructLayout(LayoutKind.Explicit)> _
    Public Structure INPUT_RECORD_UNION
        <FieldOffset(0)> Public KeyEvent As KEY_EVENT_RECORD
        <FieldOffset(0)> Public MouseEvent As MOUSE_EVENT_RECORD
        <FieldOffset(0)> Public WindowBufferSizeEvent As WINDOW_BUFFER_SIZE_RECORD
        <FieldOffset(0)> Public MenuEvent As MENU_EVENT_RECORD
        <FieldOffset(0)> Public FocusEvent As FOCUS_EVENT_RECORD
    End Structure

    <StructLayout(LayoutKind.Sequential)> _
    Public Structure INPUT_RECORD
        Public EventType As UShort
        Public [Event] As INPUT_RECORD_UNION
    End Structure

User-Defined Field Types:

Notes:

Defined in wincon.h

Windows 10 SDK: wincontypes.h

Event-Types:

    Public Enum InputEventTypes
        KEY_EVENT = &H1
        MOUSE_EVENT = &H2
        WINDOW_BUFFER_SIZE_EVENT = &H4
        MENU_EVENT = &H8
        FOCUS_EVENT = &H10
    End Enum

Documentation

  Public Enum InputEventTypes
    KEY_EVENT = &H1
    MOUSE_EVENT = &H2
    WINDOW_BUFFER_SIZE_EVENT = &H4
    MENU_EVENT = &H8
    FOCUS_EVENT = &H10
  End Enum

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