using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { /// Contains message information from a thread's message queue. // https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-msg typedef struct tagMSG { HWND hwnd; UINT message; WPARAM // wParam; LPARAM lParam; DWORD time; POINT pt; DWORD lPrivate; } MSG, *PMSG, *NPMSG, *LPMSG; [PInvokeData("winuser.h", MSDNShortId = "NS:winuser.tagMSG")] [StructLayout(LayoutKind.Sequential)] public struct MSG { /// /// A handle to the window whose window procedure receives the message. This member is NULL when the message is a thread message. /// public HWND hwnd; /// The message identifier. Applications can only use the low word; the high word is reserved by the system. public uint message; /// Additional information about the message. The exact meaning depends on the value of the message member. public IntPtr wParam; /// Additional information about the message. The exact meaning depends on the value of the message member. public IntPtr lParam; /// The time at which the message was posted. public uint time; /// The horizontal cursor position, in screen coordinates, when the message was posted. public int pt_x; /// The vertical cursor position, in screen coordinates, when the message was posted. public int pt_y; /// Initializes a new instance of the struct. /// /// A handle to the window whose window procedure receives the message. This member is NULL when the message is a thread message. /// /// The message identifier. Applications can only use the low word; the high word is reserved by the system. /// Additional information about the message. The exact meaning depends on the value of the message member. /// Additional information about the message. The exact meaning depends on the value of the message member. /// The horizontal cursor position, in screen coordinates, when the message was posted. /// The vertical cursor position, in screen coordinates, when the message was posted. /// The time at which the message was posted. public MSG(HWND hwnd, uint msg, IntPtr wParam, IntPtr lParam, int pt_x = default, int pt_y = default, uint time = default) { this.hwnd = hwnd; this.message = msg; this.wParam = wParam; this.lParam = lParam; this.time = time; this.pt_x = pt_x; this.pt_y = pt_y; } } }