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

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

C# Definition:

  [StructLayout(LayoutKind.Sequential)]
  public struct MOUSE_EVENT_RECORD
  {
    public COORD dwMousePosition;
    public MouseButtonState dwButtonState;
    public ControlKeyState dwControlKeyState;
    public MouseEventFlags dwEventFlags;
  }

  [Flags]
  public enum MouseButtonState
  {
    FROM_LEFT_1ST_BUTTON_PRESSED = 0x1,
    RIGHTMOST_BUTTON_PRESSED = 0x2,
    FROM_LEFT_2ND_BUTTON_PRESSED = 0x4,
    FROM_LEFT_3RD_BUTTON_PRESSED = 0x8,
    FROM_LEFT_4TH_BUTTON_PRESSED = 0x10
  }

  [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
  }

  [Flags]
  public enum MouseEventFlags
  {
    MOUSE_MOVED = 0x1,
    DOUBLE_CLICK = 0x2,
    MOUSE_WHEELED = 0x4,
    MOUSE_HWHEELED = 0x8
  }

VB Definition:

    <StructLayout(LayoutKind.Explicit)> _
    Public Structure MOUSE_EVENT_RECORD
        <FieldOffset(0)>
        Public dwMousePosition As COORD
        <FieldOffset(4)>
        Public dwButtonState As UInteger
        <FieldOffset(8)>
        Public dwControlKeyState As UInteger
        <FieldOffset(12)>
        Public dwEventFlags As UInteger
    End Structure

User-Defined Field Types:

UPDATE:

This started working once I changed the FOCUS_EVENT_RECORD to take a uint rather than a bool. Prior to that MOUSE_EVENT_RECORD.dwMousePosition.X was always 0

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