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

RAWINPUT (Structures)
 
.
Summary
Structure containing raw input information from a mouse device.
Summary

C# Definition:

    /// <summary>
    /// Contains information about the state of the mouse.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct RawMouse
    /// Value type for raw input.
    /// </summary>
    [StructLayout(LayoutKind.Explicit)]
    public struct RawInput
    {
        /// <summary>
        /// The mouse state.
        /// </summary>
        public RawMouseFlags Flags;
        /// <summary>Header for the data.</summary>
        [FieldOffset(0)]
        public RawInputHeader Header;
        /// <summary>Mouse raw input data.</summary>
        [FieldOffset(16)]        
        public RawInputMouse Mouse;
        /// <summary>Keyboard raw input data.</summary>
        [FieldOffset(16)]
        public RawKeyboard Keyboard;
        /// <summary>HID raw input data.</summary>
        [FieldOffset(16)]
        public RawInputHid Hid;
    }

        [StructLayout(LayoutKind.Explicit)]
        public struct Data
        {
            [FieldOffset(0)]
            public uint Buttons;
            /// <summary>
            /// If the mouse wheel is moved, this will contain the delta amount.
            /// </summary>
            [FieldOffset(2)]
            public ushort ButtonData;
            /// <summary>
            /// Flags for the event.
            /// </summary>
            [FieldOffset(0)]
            public RawMouseButtons ButtonFlags;
        }

x86/x64 safe version:

        public Data Data;

    /// <summary>
    /// Contains the raw input from a device.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct RawInput
    {
        /// <summary>
        /// Raw button data.
        /// Header for the data.
        /// </summary>
        public uint RawButtons;
        /// <summary>
        /// The motion in the X direction. This is signed relative motion or
        /// absolute motion, depending on the value of usFlags.
        /// </summary>
        public int LastX;
        /// <summary>
        /// The motion in the Y direction. This is signed relative motion or absolute motion,
        /// depending on the value of usFlags.
        /// </summary>
        public int LastY;
        /// <summary>
        /// The device-specific additional information for the event.
        /// </summary>
        public uint ExtraInformation;
        public RawInputHeader Header;
        public Union Data;
        [StructLayout(LayoutKind.Explicit)]
        public struct Union
        {
            /// <summary>
            /// Mouse raw input data.
            /// </summary>
            [FieldOffset(0)]
            public RawMouse Mouse;
            /// <summary>
            /// Keyboard raw input data.
            /// </summary>
            [FieldOffset(0)]
            public RawKeyboard Keyboard;
            /// <summary>
            /// HID raw input data.
            /// </summary>
            [FieldOffset(0)]
            public RawHID HID;
        }
    }

or

VB Definition:

    ''' <summary>Contains the raw input from a device.</summary>
    <StructLayout(LayoutKind.Sequential)>
    Public Structure RawInput
    ''' <summary>Header for the data.</summary>
    Public Header As RAWINPUTHEADER
    Public Data As Union
    <StructLayout(LayoutKind.Explicit)>
    Public Structure Union
        ''' <summary>Mouse raw input data.</summary>
        <FieldOffset(0)>
        Public Mouse As RAWMOUSE
        ''' <summary>Keyboard raw input data.</summary>
        <FieldOffset(0)>
        Public Keyboard As RAWKEYBOARD
        ''' <summary>HID raw input data.</summary>
        <FieldOffset(0)>
        Public HID As RAWHID
    End Structure
    End Structure

User-Defined Field Types:

None.

    /// <summary>
    /// Contains information about the state of the mouse.
    /// </summary>
    [StructLayout(LayoutKind.Explicit)]
    public struct RawMouse
    {
        /// <summary>
        /// The mouse state.
        /// </summary>
        [FieldOffset(0)]
        public RawMouseFlags Flags;
        /// <summary>
        /// Flags for the event.
        /// </summary>
        [FieldOffset(4)]
        public RawMouseButtons ButtonFlags;
        /// <summary>
        /// If the mouse wheel is moved, this will contain the delta amount.
        /// </summary>
        [FieldOffset(6)]
        public ushort ButtonData;
        /// <summary>
        /// Raw button data.
        /// </summary>
        [FieldOffset(8)]
        public uint RawButtons;
        /// <summary>
        /// The motion in the X direction. This is signed relative motion or
        /// absolute motion, depending on the value of usFlags.
        /// </summary>
        [FieldOffset(12)]
        public int LastX;
        /// <summary>
        /// The motion in the Y direction. This is signed relative motion or absolute motion,
        /// depending on the value of usFlags.
        /// </summary>
        [FieldOffset(16)]
        public int LastY;
        /// <summary>
        /// The device-specific additional information for the event.
        /// </summary>
        [FieldOffset(20)]
        public uint ExtraInformation;
    }

VB Definition:

Structure RAWINPUTMOUSE
   Public TODO
End Structure

User-Defined Field Types:

None.

Notes:

None.

On 64bit platform use offset size 24.

Documentation
Documentation
RAWINPUT on MSDN

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