Solved

Detect mouse movement outside application window (winForm)

Posted on 2011-03-21
41
2,976 Views
Last Modified: 2012-05-11
How to detect mouse movement when the mouse is outside the application window. Working code required in C#.

DaTribe
0
Comment
Question by:Richard Lee
  • 16
  • 10
  • 9
  • +3
41 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 35182691
You need to write a hook (dll) to process mouse messages.
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35182778
See question - Working code required.

DaTribe
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 35183115
You could use a hook via WH_MOUSE_LL to get global mouse messages...

See Bob's (TheLearnedOne) example here:
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21475143.html
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35183160
Okay that looks promising Idle_Mind however I tried a very similar code and it didn't work - possible I wasn't paying careful enough attention. I will have another go and get back to you.

DaTribe
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 250 total points
ID: 35183505
I'm kinda with Andy, I don't think the intent of this forum is to just drop-off a set of requirements and then pop back in later and pick up a finished product (which is how your question reads, whether you intended so or not) - as you well know we're all un-paid volunteers, which means you are getting something for free: our knowledge (whether you pay Experts Exchange or not).

Besides, you catch more flies with honey than vinegar! e.g. "Thanks for the suggestion, but I'm not sure how to implement the mouse hooks - can you give me a code example?" is much better than "gimme code." ;)

Having said that, I think I have a good working example - I stole the function, struct and enum declarations from www.pinvoke.net.  I've made a MouseHook class which has an event you can subscribe to: MouseMovement.  I've split up the class into three different files, just to keep the gobeldy-gook of all the P/Invoke stuff semi-organized:

MouseHook.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.ComponentModel;

namespace WindowsFormsApplication1
{
	public delegate void MouseHookEventHandler(object sender, MouseHookEventArgs e);

	public class MouseHookEventArgs : EventArgs
	{
		public int X { get; private set; }
		public int Y { get; private set; }
		public MouseHookEventArgs(int X, int Y)
		{
			this.X = X;
			this.Y = Y;
		}
	}

	public partial class MouseHook : IDisposable
	{

		private bool disposed = false;
		private IntPtr hHook = IntPtr.Zero;

		public event MouseHookEventHandler MouseMovement;

		~MouseHook()
		{
			Dispose(false);
		}
		
		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize(this);
		}

		private void Dispose(bool disposing)
		{
			if (!disposed)
			{
				disposed = true;
				StopMouseHook(false);
			}
		}

		protected virtual void OnMouseMovement(MouseHookEventArgs e)
		{
			if (MouseMovement != null)
				MouseMovement(this, e);
		}

		private IntPtr mouseProc(int code, WM wParam, ref MSLLHOOKSTRUCT lParam)
		{
			// MSDN says only process msg if code >= 0, and filter for movement events
			if (code >= 0 && wParam == WM.MOUSEMOVE)
			{
				// Raise our mousemovement event
				OnMouseMovement(new MouseHookEventArgs(lParam.pt.x, lParam.pt.y));
			}

			return CallNextHookEx(IntPtr.Zero, code, wParam, ref lParam);
			
		}

		public void StartMouseHook()
		{
			// Insert global low-level mouse hook, tell Windows to call our mouseProc method
			hHook = SetWindowsHookEx(HookType.WH_MOUSE_LL, mouseProc, IntPtr.Zero, 0);
			if (hHook == IntPtr.Zero)
				throw new Win32Exception(Marshal.GetLastWin32Error());
		}

		public void StopMouseHook()
		{
			StopMouseHook(true);
		}

		private void StopMouseHook(bool ThrowExceptionOnError)
		{
			if (hHook != IntPtr.Zero)
			{
				bool success = UnhookWindowsHookEx(hHook);
				if (!success && ThrowExceptionOnError)
					throw new Win32Exception(Marshal.GetLastWin32Error());
			}
		}
	}
}

Open in new window


MouseHook-Types-DllImports.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace WindowsFormsApplication1
{
	partial class MouseHook
	{
		[DllImport("user32.dll", SetLastError = true)]
		private static extern IntPtr SetWindowsHookEx(HookType hookType, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId);
		[DllImport("user32.dll")]
		private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, WM wParam, ref MSLLHOOKSTRUCT lParam);
		[DllImport("user32.dll", SetLastError = true)]
		private static extern bool UnhookWindowsHookEx(IntPtr hhk);

		private delegate IntPtr LowLevelMouseProc(int code, WM wParam, ref MSLLHOOKSTRUCT lParam);

		private enum HookType : int
		{
			WH_JOURNALRECORD = 0,
			WH_JOURNALPLAYBACK = 1,
			WH_KEYBOARD = 2,
			WH_GETMESSAGE = 3,
			WH_CALLWNDPROC = 4,
			WH_CBT = 5,
			WH_SYSMSGFILTER = 6,
			WH_MOUSE = 7,
			WH_HARDWARE = 8,
			WH_DEBUG = 9,
			WH_SHELL = 10,
			WH_FOREGROUNDIDLE = 11,
			WH_CALLWNDPROCRET = 12,
			WH_KEYBOARD_LL = 13,
			WH_MOUSE_LL = 14
		}

		[StructLayout(LayoutKind.Sequential)]
		private struct POINT
		{
			public int x;
			public int y;
		}

		[StructLayout(LayoutKind.Sequential)]
		private struct MSLLHOOKSTRUCT
		{
			public POINT pt;
			public uint mouseData;
			public uint flags;
			public uint time;
			public UIntPtr dwExtraInfo;
		}
	}
}

Open in new window


MouseHook-WindowsMessages.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
	partial class MouseHook
	{
		/// <summary>
  /// Windows Messages
  /// Defined in winuser.h from Windows SDK v6.1
  /// Documentation pulled from MSDN.
  /// </summary>
		public enum WM : uint
		{
			/// <summary>
			/// The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.
			/// </summary>
			NULL = 0x0000,
			/// <summary>
			/// The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible.
			/// </summary>
			CREATE = 0x0001,
			/// <summary>
			/// The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. 
			/// This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist.
			/// /// </summary>
			DESTROY = 0x0002,
			/// <summary>
			/// The WM_MOVE message is sent after a window has been moved. 
			/// </summary>
			MOVE = 0x0003,
			/// <summary>
			/// The WM_SIZE message is sent to a window after its size has changed.
			/// </summary>
			SIZE = 0x0005,
			/// <summary>
			/// The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately. 
			/// </summary>
			ACTIVATE = 0x0006,
			/// <summary>
			/// The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. 
			/// </summary>
			SETFOCUS = 0x0007,
			/// <summary>
			/// The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. 
			/// </summary>
			KILLFOCUS = 0x0008,
			/// <summary>
			/// The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. 
			/// </summary>
			ENABLE = 0x000A,
			/// <summary>
			/// An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn. 
			/// </summary>
			SETREDRAW = 0x000B,
			/// <summary>
			/// An application sends a WM_SETTEXT message to set the text of a window. 
			/// </summary>
			SETTEXT = 0x000C,
			/// <summary>
			/// An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller. 
			/// </summary>
			GETTEXT = 0x000D,
			/// <summary>
			/// An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window. 
			/// </summary>
			GETTEXTLENGTH = 0x000E,
			/// <summary>
			/// The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function. 
			/// </summary>
			PAINT = 0x000F,
			/// <summary>
			/// The WM_CLOSE message is sent as a signal that a window or an application should terminate.
			/// </summary>
			CLOSE = 0x0010,
			/// <summary>
			/// The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
			/// After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
			/// </summary>
			QUERYENDSESSION = 0x0011,
			/// <summary>
			/// The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position.
			/// </summary>
			QUERYOPEN = 0x0013,
			/// <summary>
			/// The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending.
			/// </summary>
			ENDSESSION = 0x0016,
			/// <summary>
			/// The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero.
			/// </summary>
			QUIT = 0x0012,
			/// <summary>
			/// The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting. 
			/// </summary>
			ERASEBKGND = 0x0014,
			/// <summary>
			/// This message is sent to all top-level windows when a change is made to a system color setting. 
			/// </summary>
			SYSCOLORCHANGE = 0x0015,
			/// <summary>
			/// The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
			/// </summary>
			SHOWWINDOW = 0x0018,
			/// <summary>
			/// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
			/// Note  The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
			/// </summary>
			WININICHANGE = 0x001A,
			/// <summary>
			/// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
			/// Note  The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
			/// </summary>
			SETTINGCHANGE = WM.WININICHANGE,
			/// <summary>
			/// The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings. 
			/// </summary>
			DEVMODECHANGE = 0x001B,
			/// <summary>
			/// The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.
			/// </summary>
			ACTIVATEAPP = 0x001C,
			/// <summary>
			/// An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources. 
			/// </summary>
			FONTCHANGE = 0x001D,
			/// <summary>
			/// A message that is sent whenever there is a change in the system time.
			/// </summary>
			TIMECHANGE = 0x001E,
			/// <summary>
			/// The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.
			/// </summary>
			CANCELMODE = 0x001F,
			/// <summary>
			/// The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured. 
			/// </summary>
			SETCURSOR = 0x0020,
			/// <summary>
			/// The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function.
			/// </summary>
			MOUSEACTIVATE = 0x0021,
			/// <summary>
			/// The WM_CHILDACTIVATE message is sent to a child window when the user clicks the window's title bar or when the window is activated, moved, or sized.
			/// </summary>
			CHILDACTIVATE = 0x0022,
			/// <summary>
			/// The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK Hook procedure. 
			/// </summary>
			QUEUESYNC = 0x0023,
			/// <summary>
			/// The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size. 
			/// </summary>
			GETMINMAXINFO = 0x0024,
			/// <summary>
			/// Windows NT 3.51 and earlier: The WM_PAINTICON message is sent to a minimized window when the icon is to be painted. This message is not sent by newer versions of Microsoft Windows, except in unusual circumstances explained in the Remarks.
			/// </summary>
			PAINTICON = 0x0026,
			/// <summary>
			/// Windows NT 3.51 and earlier: The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. This message is not sent by newer versions of Windows.
			/// </summary>
			ICONERASEBKGND = 0x0027,
			/// <summary>
			/// The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box. 
			/// </summary>
			NEXTDLGCTL = 0x0028,
			/// <summary>
			/// The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue. 
			/// </summary>
			SPOOLERSTATUS = 0x002A,
			/// <summary>
			/// The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
			/// </summary>
			DRAWITEM = 0x002B,
			/// <summary>
			/// The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.
			/// </summary>
			MEASUREITEM = 0x002C,
			/// <summary>
			/// Sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.
			/// </summary>
			DELETEITEM = 0x002D,
			/// <summary>
			/// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message. 
			/// </summary>
			VKEYTOITEM = 0x002E,
			/// <summary>
			/// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message. 
			/// </summary>
			CHARTOITEM = 0x002F,
			/// <summary>
			/// An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text. 
			/// </summary>
			SETFONT = 0x0030,
			/// <summary>
			/// An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text. 
			/// </summary>
			GETFONT = 0x0031,
			/// <summary>
			/// An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window. 
			/// </summary>
			SETHOTKEY = 0x0032,
			/// <summary>
			/// An application sends a WM_GETHOTKEY message to determine the hot key associated with a window. 
			/// </summary>
			GETHOTKEY = 0x0033,
			/// <summary>
			/// The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon.
			/// </summary>
			QUERYDRAGICON = 0x0037,
			/// <summary>
			/// The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style. 
			/// </summary>
			COMPAREITEM = 0x0039,
			/// <summary>
			/// Active Accessibility sends the WM_GETOBJECT message to obtain information about an accessible object contained in a server application. 
			/// Applications never send this message directly. It is sent only by Active Accessibility in response to calls to AccessibleObjectFromPoint, AccessibleObjectFromEvent, or AccessibleObjectFromWindow. However, server applications handle this message. 
			/// </summary>
			GETOBJECT = 0x003D,
			/// <summary>
			/// The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low.
			/// </summary>
			COMPACTING = 0x0041,
			/// <summary>
			/// WM_COMMNOTIFY is Obsolete for Win32-Based Applications
			/// </summary>
			[Obsolete]
			COMMNOTIFY = 0x0044,
			/// <summary>
			/// The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.
			/// </summary>
			WINDOWPOSCHANGING = 0x0046,
			/// <summary>
			/// The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function.
			/// </summary>
			WINDOWPOSCHANGED = 0x0047,
			/// <summary>
			/// Notifies applications that the system, typically a battery-powered personal computer, is about to enter a suspended mode.
			/// Use: POWERBROADCAST
			/// </summary>
			[Obsolete]
			POWER = 0x0048,
			/// <summary>
			/// An application sends the WM_COPYDATA message to pass data to another application. 
			/// </summary>
			COPYDATA = 0x004A,
			/// <summary>
			/// The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle. 
			/// </summary>
			CANCELJOURNAL = 0x004B,
			/// <summary>
			/// Sent by a common control to its parent window when an event has occurred or the control requires some information. 
			/// </summary>
			NOTIFY = 0x004E,
			/// <summary>
			/// The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately. 
			/// </summary>
			INPUTLANGCHANGEREQUEST = 0x0050,
			/// <summary>
			/// The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on. 
			/// </summary>
			INPUTLANGCHANGE = 0x0051,
			/// <summary>
			/// Sent to an application that has initiated a training card with Microsoft Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function.
			/// </summary>
			TCARD = 0x0052,
			/// <summary>
			/// Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window. 
			/// </summary>
			HELP = 0x0053,
			/// <summary>
			/// The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings.
			/// </summary>
			USERCHANGED = 0x0054,
			/// <summary>
			/// Determines if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control.
			/// </summary>
			NOTIFYFORMAT = 0x0055,
			/// <summary>
			/// The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right-clicked) in the window.
			/// </summary>
			CONTEXTMENU = 0x007B,
			/// <summary>
			/// The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.
			/// </summary>
			STYLECHANGING = 0x007C,
			/// <summary>
			/// The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles
			/// </summary>
			STYLECHANGED = 0x007D,
			/// <summary>
			/// The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
			/// </summary>
			DISPLAYCHANGE = 0x007E,
			/// <summary>
			/// The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption. 
			/// </summary>
			GETICON = 0x007F,
			/// <summary>
			/// An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption. 
			/// </summary>
			SETICON = 0x0080,
			/// <summary>
			/// The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.
			/// </summary>
			NCCREATE = 0x0081,
			/// <summary>
			/// The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window. 
			/// The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast, WM_DESTROY is sent before the child windows are destroyed.
			/// </summary>
			NCDESTROY = 0x0082,
			/// <summary>
			/// The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes.
			/// </summary>
			NCCALCSIZE = 0x0083,
			/// <summary>
			/// The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.
			/// </summary>
			NCHITTEST = 0x0084,
			/// <summary>
			/// The WM_NCPAINT message is sent to a window when its frame must be painted. 
			/// </summary>
			NCPAINT = 0x0085,
			/// <summary>
			/// The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state.
			/// </summary>
			NCACTIVATE = 0x0086,
			/// <summary>
			/// The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
			/// </summary>
			GETDLGCODE = 0x0087,
			/// <summary>
			/// The WM_SYNCPAINT message is used to synchronize painting while avoiding linking independent GUI threads.
			/// </summary>
			SYNCPAINT = 0x0088,
			/// <summary>
			/// The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMOUSEMOVE = 0x00A0,
			/// <summary>
			/// The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCLBUTTONDOWN = 0x00A1,
			/// <summary>
			/// The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCLBUTTONUP = 0x00A2,
			/// <summary>
			/// The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCLBUTTONDBLCLK = 0x00A3,
			/// <summary>
			/// The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCRBUTTONDOWN = 0x00A4,
			/// <summary>
			/// The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCRBUTTONUP = 0x00A5,
			/// <summary>
			/// The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCRBUTTONDBLCLK = 0x00A6,
			/// <summary>
			/// The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMBUTTONDOWN = 0x00A7,
			/// <summary>
			/// The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMBUTTONUP = 0x00A8,
			/// <summary>
			/// The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMBUTTONDBLCLK = 0x00A9,
			/// <summary>
			/// The WM_NCXBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCXBUTTONDOWN = 0x00AB,
			/// <summary>
			/// The WM_NCXBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCXBUTTONUP = 0x00AC,
			/// <summary>
			/// The WM_NCXBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCXBUTTONDBLCLK = 0x00AD,
			/// <summary>
			/// The WM_INPUT_DEVICE_CHANGE message is sent to the window that registered to receive raw input. A window receives this message through its WindowProc function.
			/// </summary>
			INPUT_DEVICE_CHANGE = 0x00FE,
			/// <summary>
			/// The WM_INPUT message is sent to the window that is getting raw input. 
			/// </summary>
			INPUT = 0x00FF,
			/// <summary>
			/// This message filters for keyboard messages.
			/// </summary>
			KEYFIRST = 0x0100,
			/// <summary>
			/// The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. 
			/// </summary>
			KEYDOWN = 0x0100,
			/// <summary>
			/// The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus. 
			/// </summary>
			KEYUP = 0x0101,
			/// <summary>
			/// The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed. 
			/// </summary>
			CHAR = 0x0102,
			/// <summary>
			/// The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key. 
			/// </summary>
			DEADCHAR = 0x0103,
			/// <summary>
			/// The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. 
			/// </summary>
			SYSKEYDOWN = 0x0104,
			/// <summary>
			/// The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. 
			/// </summary>
			SYSKEYUP = 0x0105,
			/// <summary>
			/// The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down. 
			/// </summary>
			SYSCHAR = 0x0106,
			/// <summary>
			/// The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the ALT key. 
			/// </summary>
			SYSDEADCHAR = 0x0107,
			/// <summary>
			/// The WM_UNICHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_UNICHAR message contains the character code of the key that was pressed. 
			/// The WM_UNICHAR message is equivalent to WM_CHAR, but it uses Unicode Transformation Format (UTF)-32, whereas WM_CHAR uses UTF-16. It is designed to send or post Unicode characters to ANSI windows and it can can handle Unicode Supplementary Plane characters.
			/// </summary>
			UNICHAR = 0x0109,
			/// <summary>
			/// This message filters for keyboard messages.
			/// </summary>
			KEYLAST = 0x0109,
			/// <summary>
			/// Sent immediately before the IME generates the composition string as a result of a keystroke. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_STARTCOMPOSITION = 0x010D,
			/// <summary>
			/// Sent to an application when the IME ends composition. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_ENDCOMPOSITION = 0x010E,
			/// <summary>
			/// Sent to an application when the IME changes composition status as a result of a keystroke. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_COMPOSITION = 0x010F,
			IME_KEYLAST = 0x010F,
			/// <summary>
			/// The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box. 
			/// </summary>
			INITDIALOG = 0x0110,
			/// <summary>
			/// The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated. 
			/// </summary>
			COMMAND = 0x0111,
			/// <summary>
			/// A window receives this message when the user chooses a command from the Window menu, clicks the maximize button, minimize button, restore button, close button, or moves the form. You can stop the form from moving by filtering this out.
			/// </summary>
			SYSCOMMAND = 0x0112,
			/// <summary>
			/// The WM_TIMER message is posted to the installing thread's message queue when a timer expires. The message is posted by the GetMessage or PeekMessage function. 
			/// </summary>
			TIMER = 0x0113,
			/// <summary>
			/// The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control. 
			/// </summary>
			HSCROLL = 0x0114,
			/// <summary>
			/// The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control. 
			/// </summary>
			VSCROLL = 0x0115,
			/// <summary>
			/// The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed. 
			/// </summary>
			INITMENU = 0x0116,
			/// <summary>
			/// The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu. 
			/// </summary>
			INITMENUPOPUP = 0x0117,
			/// <summary>
			/// The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item. 
			/// </summary>
			MENUSELECT = 0x011F,
			/// <summary>
			/// The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu. 
			/// </summary>
			MENUCHAR = 0x0120,
			/// <summary>
			/// The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages. 
			/// </summary>
			ENTERIDLE = 0x0121,
			/// <summary>
			/// The WM_MENURBUTTONUP message is sent when the user releases the right mouse button while the cursor is on a menu item. 
			/// </summary>
			MENURBUTTONUP = 0x0122,
			/// <summary>
			/// The WM_MENUDRAG message is sent to the owner of a drag-and-drop menu when the user drags a menu item. 
			/// </summary>
			MENUDRAG = 0x0123,
			/// <summary>
			/// The WM_MENUGETOBJECT message is sent to the owner of a drag-and-drop menu when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item. 
			/// </summary>
			MENUGETOBJECT = 0x0124,
			/// <summary>
			/// The WM_UNINITMENUPOPUP message is sent when a drop-down menu or submenu has been destroyed. 
			/// </summary>
			UNINITMENUPOPUP = 0x0125,
			/// <summary>
			/// The WM_MENUCOMMAND message is sent when the user makes a selection from a menu. 
			/// </summary>
			MENUCOMMAND = 0x0126,
			/// <summary>
			/// An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed.
			/// </summary>
			CHANGEUISTATE = 0x0127,
			/// <summary>
			/// An application sends the WM_UPDATEUISTATE message to change the user interface (UI) state for the specified window and all its child windows.
			/// </summary>
			UPDATEUISTATE = 0x0128,
			/// <summary>
			/// An application sends the WM_QUERYUISTATE message to retrieve the user interface (UI) state for a window.
			/// </summary>
			QUERYUISTATE = 0x0129,
			/// <summary>
			/// The WM_CTLCOLORMSGBOX message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the given display device context handle. 
			/// </summary>
			CTLCOLORMSGBOX = 0x0132,
			/// <summary>
			/// An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control. 
			/// </summary>
			CTLCOLOREDIT = 0x0133,
			/// <summary>
			/// Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle. 
			/// </summary>
			CTLCOLORLISTBOX = 0x0134,
			/// <summary>
			/// The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message. 
			/// </summary>
			CTLCOLORBTN = 0x0135,
			/// <summary>
			/// The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle. 
			/// </summary>
			CTLCOLORDLG = 0x0136,
			/// <summary>
			/// The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control. 
			/// </summary>
			CTLCOLORSCROLLBAR = 0x0137,
			/// <summary>
			/// A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control. 
			/// </summary>
			CTLCOLORSTATIC = 0x0138,
			/// <summary>
			/// Use WM_MOUSEFIRST to specify the first mouse message. Use the PeekMessage() Function.
			/// </summary>
			MOUSEFIRST = 0x0200,
			/// <summary>
			/// The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MOUSEMOVE = 0x0200,
			/// <summary>
			/// The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			LBUTTONDOWN = 0x0201,
			/// <summary>
			/// The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			LBUTTONUP = 0x0202,
			/// <summary>
			/// The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			LBUTTONDBLCLK = 0x0203,
			/// <summary>
			/// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			RBUTTONDOWN = 0x0204,
			/// <summary>
			/// The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			RBUTTONUP = 0x0205,
			/// <summary>
			/// The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			RBUTTONDBLCLK = 0x0206,
			/// <summary>
			/// The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MBUTTONDOWN = 0x0207,
			/// <summary>
			/// The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MBUTTONUP = 0x0208,
			/// <summary>
			/// The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MBUTTONDBLCLK = 0x0209,
			/// <summary>
			/// The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
			/// </summary>
			MOUSEWHEEL = 0x020A,
			/// <summary>
			/// The WM_XBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
			/// </summary>
			XBUTTONDOWN = 0x020B,
			/// <summary>
			/// The WM_XBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			XBUTTONUP = 0x020C,
			/// <summary>
			/// The WM_XBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			XBUTTONDBLCLK = 0x020D,
			/// <summary>
			/// The WM_MOUSEHWHEEL message is sent to the focus window when the mouse's horizontal scroll wheel is tilted or rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
			/// </summary>
			MOUSEHWHEEL = 0x020E,
			/// <summary>
			/// Use WM_MOUSELAST to specify the last mouse message. Used with PeekMessage() Function.
			/// </summary>
			MOUSELAST = 0x020E,
			/// <summary>
			/// The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place.
			/// </summary>
			PARENTNOTIFY = 0x0210,
			/// <summary>
			/// The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered. 
			/// </summary>
			ENTERMENULOOP = 0x0211,
			/// <summary>
			/// The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited. 
			/// </summary>
			EXITMENULOOP = 0x0212,
			/// <summary>
			/// The WM_NEXTMENU message is sent to an application when the right or left arrow key is used to switch between the menu bar and the system menu. 
			/// </summary>
			NEXTMENU = 0x0213,
			/// <summary>
			/// The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position. 
			/// </summary>
			SIZING = 0x0214,
			/// <summary>
			/// The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.
			/// </summary>
			CAPTURECHANGED = 0x0215,
			/// <summary>
			/// The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position.
			/// </summary>
			MOVING = 0x0216,
			/// <summary>
			/// Notifies applications that a power-management event has occurred.
			/// </summary>
			POWERBROADCAST = 0x0218,
			/// <summary>
			/// Notifies an application of a change to the hardware configuration of a device or the computer.
			/// </summary>
			DEVICECHANGE = 0x0219,
			/// <summary>
			/// An application sends the WM_MDICREATE message to a multiple-document interface (MDI) client window to create an MDI child window. 
			/// </summary>
			MDICREATE = 0x0220,
			/// <summary>
			/// An application sends the WM_MDIDESTROY message to a multiple-document interface (MDI) client window to close an MDI child window. 
			/// </summary>
			MDIDESTROY = 0x0221,
			/// <summary>
			/// An application sends the WM_MDIACTIVATE message to a multiple-document interface (MDI) client window to instruct the client window to activate a different MDI child window. 
			/// </summary>
			MDIACTIVATE = 0x0222,
			/// <summary>
			/// An application sends the WM_MDIRESTORE message to a multiple-document interface (MDI) client window to restore an MDI child window from maximized or minimized size. 
			/// </summary>
			MDIRESTORE = 0x0223,
			/// <summary>
			/// An application sends the WM_MDINEXT message to a multiple-document interface (MDI) client window to activate the next or previous child window. 
			/// </summary>
			MDINEXT = 0x0224,
			/// <summary>
			/// An application sends the WM_MDIMAXIMIZE message to a multiple-document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window. 
			/// </summary>
			MDIMAXIMIZE = 0x0225,
			/// <summary>
			/// An application sends the WM_MDITILE message to a multiple-document interface (MDI) client window to arrange all of its MDI child windows in a tile format. 
			/// </summary>
			MDITILE = 0x0226,
			/// <summary>
			/// An application sends the WM_MDICASCADE message to a multiple-document interface (MDI) client window to arrange all its child windows in a cascade format. 
			/// </summary>
			MDICASCADE = 0x0227,
			/// <summary>
			/// An application sends the WM_MDIICONARRANGE message to a multiple-document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized. 
			/// </summary>
			MDIICONARRANGE = 0x0228,
			/// <summary>
			/// An application sends the WM_MDIGETACTIVE message to a multiple-document interface (MDI) client window to retrieve the handle to the active MDI child window. 
			/// </summary>
			MDIGETACTIVE = 0x0229,
			/// <summary>
			/// An application sends the WM_MDISETMENU message to a multiple-document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the window menu of the frame window, or both. 
			/// </summary>
			MDISETMENU = 0x0230,
			/// <summary>
			/// The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
			/// The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled.
			/// </summary>
			ENTERSIZEMOVE = 0x0231,
			/// <summary>
			/// The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
			/// </summary>
			EXITSIZEMOVE = 0x0232,
			/// <summary>
			/// Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files.
			/// </summary>
			DROPFILES = 0x0233,
			/// <summary>
			/// An application sends the WM_MDIREFRESHMENU message to a multiple-document interface (MDI) client window to refresh the window menu of the MDI frame window. 
			/// </summary>
			MDIREFRESHMENU = 0x0234,
			/// <summary>
			/// Sent to an application when a window is activated. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_SETCONTEXT = 0x0281,
			/// <summary>
			/// Sent to an application to notify it of changes to the IME window. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_NOTIFY = 0x0282,
			/// <summary>
			/// Sent by an application to direct the IME window to carry out the requested command. The application uses this message to control the IME window that it has created. To send this message, the application calls the SendMessage function with the following parameters.
			/// </summary>
			IME_CONTROL = 0x0283,
			/// <summary>
			/// Sent to an application when the IME window finds no space to extend the area for the composition window. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_COMPOSITIONFULL = 0x0284,
			/// <summary>
			/// Sent to an application when the operating system is about to change the current IME. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_SELECT = 0x0285,
			/// <summary>
			/// Sent to an application when the IME gets a character of the conversion result. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_CHAR = 0x0286,
			/// <summary>
			/// Sent to an application to provide commands and request information. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_REQUEST = 0x0288,
			/// <summary>
			/// Sent to an application by the IME to notify the application of a key press and to keep message order. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_KEYDOWN = 0x0290,
			/// <summary>
			/// Sent to an application by the IME to notify the application of a key release and to keep message order. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_KEYUP = 0x0291,
			/// <summary>
			/// The WM_MOUSEHOVER message is posted to a window when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent.
			/// </summary>
			MOUSEHOVER = 0x02A1,
			/// <summary>
			/// The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
			/// </summary>
			MOUSELEAVE = 0x02A3,
			/// <summary>
			/// The WM_NCMOUSEHOVER message is posted to a window when the cursor hovers over the nonclient area of the window for the period of time specified in a prior call to TrackMouseEvent.
			/// </summary>
			NCMOUSEHOVER = 0x02A0,
			/// <summary>
			/// The WM_NCMOUSELEAVE message is posted to a window when the cursor leaves the nonclient area of the window specified in a prior call to TrackMouseEvent.
			/// </summary>
			NCMOUSELEAVE = 0x02A2,
			/// <summary>
			/// The WM_WTSSESSION_CHANGE message notifies applications of changes in session state.
			/// </summary>
			WTSSESSION_CHANGE = 0x02B1,
			TABLET_FIRST = 0x02c0,
			TABLET_LAST = 0x02df,
			/// <summary>
			/// An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format. 
			/// </summary>
			CUT = 0x0300,
			/// <summary>
			/// An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format. 
			/// </summary>
			COPY = 0x0301,
			/// <summary>
			/// An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format. 
			/// </summary>
			PASTE = 0x0302,
			/// <summary>
			/// An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control. 
			/// </summary>
			CLEAR = 0x0303,
			/// <summary>
			/// An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted.
			/// </summary>
			UNDO = 0x0304,
			/// <summary>
			/// The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function. 
			/// </summary>
			RENDERFORMAT = 0x0305,
			/// <summary>
			/// The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function. 
			/// </summary>
			RENDERALLFORMATS = 0x0306,
			/// <summary>
			/// The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard. 
			/// </summary>
			DESTROYCLIPBOARD = 0x0307,
			/// <summary>
			/// The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard. 
			/// </summary>
			DRAWCLIPBOARD = 0x0308,
			/// <summary>
			/// The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting. 
			/// </summary>
			PAINTCLIPBOARD = 0x0309,
			/// <summary>
			/// The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
			/// </summary>
			VSCROLLCLIPBOARD = 0x030A,
			/// <summary>
			/// The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size. 
			/// </summary>
			SIZECLIPBOARD = 0x030B,
			/// <summary>
			/// The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.
			/// </summary>
			ASKCBFORMATNAME = 0x030C,
			/// <summary>
			/// The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain. 
			/// </summary>
			CHANGECBCHAIN = 0x030D,
			/// <summary>
			/// The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
			/// </summary>
			HSCROLLCLIPBOARD = 0x030E,
			/// <summary>
			/// This message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus. 
			/// </summary>
			QUERYNEWPALETTE = 0x030F,
			/// <summary>
			/// The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette. 
			/// </summary>
			PALETTEISCHANGING = 0x0310,
			/// <summary>
			/// This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette. 
			/// This message enables windows that do not have the keyboard focus to realize their logical palettes and update their client areas.
			/// </summary>
			PALETTECHANGED = 0x0311,
			/// <summary>
			/// The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key. 
			/// </summary>
			HOTKEY = 0x0312,
			/// <summary>
			/// The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.
			/// </summary>
			PRINT = 0x0317,
			/// <summary>
			/// The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.
			/// </summary>
			PRINTCLIENT = 0x0318,
			/// <summary>
			/// The WM_APPCOMMAND message notifies a window that the user generated an application command event, for example, by clicking an application command button using the mouse or typing an application command key on the keyboard.
			/// </summary>
			APPCOMMAND = 0x0319,
			/// <summary>
			/// The WM_THEMECHANGED message is broadcast to every window following a theme change event. Examples of theme change events are the activation of a theme, the deactivation of a theme, or a transition from one theme to another.
			/// </summary>
			THEMECHANGED = 0x031A,
			/// <summary>
			/// Sent when the contents of the clipboard have changed.
			/// </summary>
			CLIPBOARDUPDATE = 0x031D,
			/// <summary>
			/// The system will send a window the WM_DWMCOMPOSITIONCHANGED message to indicate that the availability of desktop composition has changed.
			/// </summary>
			DWMCOMPOSITIONCHANGED = 0x031E,
			/// <summary>
			/// WM_DWMNCRENDERINGCHANGED is called when the non-client area rendering status of a window has changed. Only windows that have set the flag DWM_BLURBEHIND.fTransitionOnMaximized to true will get this message. 
			/// </summary>
			DWMNCRENDERINGCHANGED = 0x031F,
			/// <summary>
			/// Sent to all top-level windows when the colorization color has changed. 
			/// </summary>
			DWMCOLORIZATIONCOLORCHANGED = 0x0320,
			/// <summary>
			/// WM_DWMWINDOWMAXIMIZEDCHANGE will let you know when a DWM composed window is maximized. You also have to register for this message as well. You'd have other windowd go opaque when this message is sent.
			/// </summary>
			DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
			/// <summary>
			/// Sent to request extended title bar information. A window receives this message through its WindowProc function.
			/// </summary>
			GETTITLEBARINFOEX = 0x033F,
			HANDHELDFIRST = 0x0358,
			HANDHELDLAST = 0x035F,
			AFXFIRST = 0x0360,
			AFXLAST = 0x037F,
			PENWINFIRST = 0x0380,
			PENWINLAST = 0x038F,
			/// <summary>
			/// The WM_APP constant is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value. 
			/// </summary>
			APP = 0x8000,
			/// <summary>
			/// The WM_USER constant is used by applications to help define private messages for use by private window classes, usually of the form WM_USER+X, where X is an integer value. 
			/// </summary>
			USER = 0x0400,

			/// <summary>
			/// An application sends the WM_CPL_LAUNCH message to Windows Control Panel to request that a Control Panel application be started. 
			/// </summary>
			CPL_LAUNCH = USER + 0x1000,
			/// <summary>
			/// The WM_CPL_LAUNCHED message is sent when a Control Panel application, started by the WM_CPL_LAUNCH message, has closed. The WM_CPL_LAUNCHED message is sent to the window identified by the wParam parameter of the WM_CPL_LAUNCH message that started the application. 
			/// </summary>
			CPL_LAUNCHED = USER + 0x1001,
			/// <summary>
			/// WM_SYSTIMER is a well-known yet still undocumented message. Windows uses WM_SYSTIMER for internal actions like scrolling.
			/// </summary>
			SYSTIMER = 0x118
		}
	}
}

Open in new window

0
 
LVL 33

Assisted Solution

by:Todd Gerbert
Todd Gerbert earned 250 total points
ID: 35183527
And my usage looks like:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
	public partial class Form1 : Form
	{
		private MouseHook mh;

		public Form1()
		{
			InitializeComponent();

			mh = new MouseHook();
			mh.MouseMovement += new MouseHookEventHandler(mh_MouseMovement);
			mh.StartMouseHook();
		}

		void mh_MouseMovement(object sender, MouseHookEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(String.Format("X: {0}, Y: {1}", e.X, e.Y));
		}

		private void Form1_FormClosing(object sender, FormClosingEventArgs e)
		{
			mh.Dispose();
		}
	}
}

Open in new window

0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35184118
If I were asking for an entire application then I could understand however I stated clearly that I needed a code example for a short feature. If you read my response to Idle_Mind you would see that I have made an attempt to solve the problem before. Plus if you do not wish to provide what is asked for then don't post any comments/solutions. Simple enough isn't it!?

DaTribe
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35184325
Yes, it is a little irritating but 1) AndyAinscow is hardly a hustler (I often see his comments, and just as often his solutions are better than mine) and 2) not nearly as irritating as someone who is benefitting from the kindness of others and has the nerve to complain that said kindness is not up to snuff. I realize it's generally not possible to convey a tone of voice, or implied meaning, with the written word is why I pointed out that your question read as though a complete product was required, even though you obviously didn't intend that.  Your question also didn't mention you had made any attempt at all yourself at solving the problem, I'd wager his response would have been much different if you had said "I'm trying this sample and it's not working because..." or "This is what I've got so far, but..."  Further, what's asked for and what the correct answer is do not always coincide; as contributors we all, at times, judge an asker's question and try to decide for ourselves what he really needs, and comments such as "you need hooks to process mouse messages" can serve as the start of a dialog that leads to the asker's needs being met, or start the asker down a path such that he is able to solve the problem himself.

<soap box dis-engaged>

Enough of that though...did the code samples in http:#a35183115 or http:#a35183505 make any sense?
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 35186802
@tgerbert - thankyou for the compliment.
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35187068
So you are telling me AndyAinscow's first comment made any sense? Don't you think one Google would have already given me that? A feeble attempt to get some points.

I will have a look at the solution tgerbert and get back to you.

DaTribe
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35187109
I am sorry tgerbert but I am not with you on that. I provided a clear question and what I expected was an answer that satisfied that question. If the person who is attempting a solution doesn't have it then they shouldn't post or be clear in their post that they don't have a complete solution. Simple rushing through the question list to try an get through as many questions as possible to get more points is not suitable, and by no means helps the people who are asking the questions.

Can you dispute that looking at AndyAinscow's first comment? Don't you think I have already googled? Why do I have to make that clear? You tgerbert clearly understood the question and posted what was asked for.

DaTribe

0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 35187140
This is your question - complete.

>>How to detect mouse movement when the mouse is outside the application window. Working code required in C#.

Please show me, by highlighting, where you indicate you have googled/tried or anything else to even attempt to solve it yourself.  To criticise other experts based on information you don't tell then is not very useful.  You are a contributing expert here.  If you now searched at EE for a mouse hook dll I bet you would find examples.

Often some simple comments are required at first before it is even clear about just what is required and how skillful at coding the asker is.  
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35187257
My criticism of you is simple. I don't have to provide proof that I tried to solve it, I asked as simple question and you don't have the answer to that then don't post! No discussion is needed because you clearly understood, as did everyone else what was being asked for, however you chose to take the short cut.

DaTribe
0
 
LVL 19

Assisted Solution

by:Daniel Van Der Werken
Daniel Van Der Werken earned 125 total points
ID: 35188706
tgebert -- your solution worked for me but I had to do one thing differently than what you posted.  I had to add the following:

        [DllImport( "kernel32.dll", SetLastError = true )]
        private static extern IntPtr GetModuleHandle( IntPtr lpModuleName );

and then change this:

        public void StartMouseHook()
        {
            // Insert global low-level mouse hook, tell Windows to call our mouseProc method
            IntPtr iptrNull = GetModuleHandle( IntPtr.Zero );
            hHook = SetWindowsHookEx( HookType.WH_MOUSE_LL, mouseProc, iptrNull, 0 );

            int error = Marshal.GetLastWin32Error();
            if ( error != 0 )
                throw new Win32Exception( error );
        }

Otherwise, I got an error.  I don't know if it will work for other folks without these changes, so I'm posting them.  I also made my code one massive class rather than all those partial classes.  Easier for me.  Here is my full code.  If  you copy and paste this into a Windows Forms app and create the TextBox control on the form, it should work:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using System.Reflection;

namespace WindowsFormsApplication1
{
    public delegate void MouseHookEventHandler( object sender, MouseHookEventArgs e );

    public partial class Form1 : Form
    {
        private const string XY = "x = {0}, y = {1}";
        private MouseHook mh; 

        public Form1()
        {
            InitializeComponent();
            mh = new MouseHook();
            mh.MouseMovement += new MouseHookEventHandler( mh_MouseMovement );
            mh.StartMouseHook();

        }

        void mh_MouseMovement( object sender, MouseHookEventArgs e )
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat( XY, e.X.ToString(), e.Y.ToString() );
            textBox1.Clear();
            textBox1.Text = sb.ToString();
        }

        private void Form1_FormClosing( object sender, FormClosingEventArgs e )
        {
            mh.Dispose();
        }
    }

    public class MouseHookEventArgs : EventArgs
    {
        public int X { get; private set; }
        public int Y { get; private set; }
        public MouseHookEventArgs( int X, int Y )
        {
            this.X = X;
            this.Y = Y;
        }
    }

	public class MouseHook : IDisposable
	{
        private bool disposed = false;
        private IntPtr hHook = IntPtr.Zero;

        public event MouseHookEventHandler MouseMovement;

        ~MouseHook()
        {
            Dispose( false );
        }

        public void Dispose()
        {
            Dispose( true );
            GC.SuppressFinalize( this );
        }

        private void Dispose( bool disposing )
        {
            if ( !disposed )
            {
                disposed = true;
                StopMouseHook( false );
            }
        }

        protected virtual void OnMouseMovement( MouseHookEventArgs e )
        {
            if ( MouseMovement != null )
                MouseMovement( this, e );
        }

        private IntPtr mouseProc( int code, WM wParam, ref MSLLHOOKSTRUCT lParam )
        {
            // MSDN says only process msg if code >= 0, and filter for movement events
            if ( code >= 0 && wParam == WM.MOUSEMOVE )
            {
                // Raise our mousemovement event
                OnMouseMovement( new MouseHookEventArgs( lParam.pt.x, lParam.pt.y ) );
            }

            return CallNextHookEx( IntPtr.Zero, code, wParam, ref lParam );

        }

        public void StartMouseHook()
        {
            // Insert global low-level mouse hook, tell Windows to call our mouseProc method
            IntPtr iptrNull = GetModuleHandle( IntPtr.Zero );
            hHook = SetWindowsHookEx( HookType.WH_MOUSE_LL, mouseProc, iptrNull, 0 );

            int error = Marshal.GetLastWin32Error();
            if ( error != 0 )
                throw new Win32Exception( error );
        }

        public void StopMouseHook()
        {
            StopMouseHook( true );
        }

        private void StopMouseHook( bool ThrowExceptionOnError )
        {
            if ( hHook != IntPtr.Zero )
            {
                bool success = UnhookWindowsHookEx( hHook );
                if ( !success && ThrowExceptionOnError )
                    throw new Win32Exception( Marshal.GetLastWin32Error() );
            }
        }


		/// <summary>
        /// Windows Messages
        /// Defined in winuser.h from Windows SDK v6.1
        /// Documentation pulled from MSDN.
        /// </summary>
		public enum WM : uint
		{
			/// <summary>
			/// The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.
			/// </summary>
			NULL = 0x0000,
			/// <summary>
			/// The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible.
			/// </summary>
			CREATE = 0x0001,
			/// <summary>
			/// The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. 
			/// This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist.
			/// /// </summary>
			DESTROY = 0x0002,
			/// <summary>
			/// The WM_MOVE message is sent after a window has been moved. 
			/// </summary>
			MOVE = 0x0003,
			/// <summary>
			/// The WM_SIZE message is sent to a window after its size has changed.
			/// </summary>
			SIZE = 0x0005,
			/// <summary>
			/// The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately. 
			/// </summary>
			ACTIVATE = 0x0006,
			/// <summary>
			/// The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. 
			/// </summary>
			SETFOCUS = 0x0007,
			/// <summary>
			/// The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. 
			/// </summary>
			KILLFOCUS = 0x0008,
			/// <summary>
			/// The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. 
			/// </summary>
			ENABLE = 0x000A,
			/// <summary>
			/// An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn. 
			/// </summary>
			SETREDRAW = 0x000B,
			/// <summary>
			/// An application sends a WM_SETTEXT message to set the text of a window. 
			/// </summary>
			SETTEXT = 0x000C,
			/// <summary>
			/// An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller. 
			/// </summary>
			GETTEXT = 0x000D,
			/// <summary>
			/// An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window. 
			/// </summary>
			GETTEXTLENGTH = 0x000E,
			/// <summary>
			/// The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function. 
			/// </summary>
			PAINT = 0x000F,
			/// <summary>
			/// The WM_CLOSE message is sent as a signal that a window or an application should terminate.
			/// </summary>
			CLOSE = 0x0010,
			/// <summary>
			/// The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
			/// After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
			/// </summary>
			QUERYENDSESSION = 0x0011,
			/// <summary>
			/// The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position.
			/// </summary>
			QUERYOPEN = 0x0013,
			/// <summary>
			/// The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending.
			/// </summary>
			ENDSESSION = 0x0016,
			/// <summary>
			/// The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero.
			/// </summary>
			QUIT = 0x0012,
			/// <summary>
			/// The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting. 
			/// </summary>
			ERASEBKGND = 0x0014,
			/// <summary>
			/// This message is sent to all top-level windows when a change is made to a system color setting. 
			/// </summary>
			SYSCOLORCHANGE = 0x0015,
			/// <summary>
			/// The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
			/// </summary>
			SHOWWINDOW = 0x0018,
			/// <summary>
			/// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
			/// Note  The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
			/// </summary>
			WININICHANGE = 0x001A,
			/// <summary>
			/// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
			/// Note  The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
			/// </summary>
			SETTINGCHANGE = WM.WININICHANGE,
			/// <summary>
			/// The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings. 
			/// </summary>
			DEVMODECHANGE = 0x001B,
			/// <summary>
			/// The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.
			/// </summary>
			ACTIVATEAPP = 0x001C,
			/// <summary>
			/// An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources. 
			/// </summary>
			FONTCHANGE = 0x001D,
			/// <summary>
			/// A message that is sent whenever there is a change in the system time.
			/// </summary>
			TIMECHANGE = 0x001E,
			/// <summary>
			/// The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.
			/// </summary>
			CANCELMODE = 0x001F,
			/// <summary>
			/// The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured. 
			/// </summary>
			SETCURSOR = 0x0020,
			/// <summary>
			/// The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function.
			/// </summary>
			MOUSEACTIVATE = 0x0021,
			/// <summary>
			/// The WM_CHILDACTIVATE message is sent to a child window when the user clicks the window's title bar or when the window is activated, moved, or sized.
			/// </summary>
			CHILDACTIVATE = 0x0022,
			/// <summary>
			/// The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK Hook procedure. 
			/// </summary>
			QUEUESYNC = 0x0023,
			/// <summary>
			/// The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size. 
			/// </summary>
			GETMINMAXINFO = 0x0024,
			/// <summary>
			/// Windows NT 3.51 and earlier: The WM_PAINTICON message is sent to a minimized window when the icon is to be painted. This message is not sent by newer versions of Microsoft Windows, except in unusual circumstances explained in the Remarks.
			/// </summary>
			PAINTICON = 0x0026,
			/// <summary>
			/// Windows NT 3.51 and earlier: The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. This message is not sent by newer versions of Windows.
			/// </summary>
			ICONERASEBKGND = 0x0027,
			/// <summary>
			/// The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box. 
			/// </summary>
			NEXTDLGCTL = 0x0028,
			/// <summary>
			/// The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue. 
			/// </summary>
			SPOOLERSTATUS = 0x002A,
			/// <summary>
			/// The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
			/// </summary>
			DRAWITEM = 0x002B,
			/// <summary>
			/// The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.
			/// </summary>
			MEASUREITEM = 0x002C,
			/// <summary>
			/// Sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.
			/// </summary>
			DELETEITEM = 0x002D,
			/// <summary>
			/// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message. 
			/// </summary>
			VKEYTOITEM = 0x002E,
			/// <summary>
			/// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message. 
			/// </summary>
			CHARTOITEM = 0x002F,
			/// <summary>
			/// An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text. 
			/// </summary>
			SETFONT = 0x0030,
			/// <summary>
			/// An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text. 
			/// </summary>
			GETFONT = 0x0031,
			/// <summary>
			/// An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window. 
			/// </summary>
			SETHOTKEY = 0x0032,
			/// <summary>
			/// An application sends a WM_GETHOTKEY message to determine the hot key associated with a window. 
			/// </summary>
			GETHOTKEY = 0x0033,
			/// <summary>
			/// The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon.
			/// </summary>
			QUERYDRAGICON = 0x0037,
			/// <summary>
			/// The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style. 
			/// </summary>
			COMPAREITEM = 0x0039,
			/// <summary>
			/// Active Accessibility sends the WM_GETOBJECT message to obtain information about an accessible object contained in a server application. 
			/// Applications never send this message directly. It is sent only by Active Accessibility in response to calls to AccessibleObjectFromPoint, AccessibleObjectFromEvent, or AccessibleObjectFromWindow. However, server applications handle this message. 
			/// </summary>
			GETOBJECT = 0x003D,
			/// <summary>
			/// The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low.
			/// </summary>
			COMPACTING = 0x0041,
			/// <summary>
			/// WM_COMMNOTIFY is Obsolete for Win32-Based Applications
			/// </summary>
			[Obsolete]
			COMMNOTIFY = 0x0044,
			/// <summary>
			/// The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.
			/// </summary>
			WINDOWPOSCHANGING = 0x0046,
			/// <summary>
			/// The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function.
			/// </summary>
			WINDOWPOSCHANGED = 0x0047,
			/// <summary>
			/// Notifies applications that the system, typically a battery-powered personal computer, is about to enter a suspended mode.
			/// Use: POWERBROADCAST
			/// </summary>
			[Obsolete]
			POWER = 0x0048,
			/// <summary>
			/// An application sends the WM_COPYDATA message to pass data to another application. 
			/// </summary>
			COPYDATA = 0x004A,
			/// <summary>
			/// The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle. 
			/// </summary>
			CANCELJOURNAL = 0x004B,
			/// <summary>
			/// Sent by a common control to its parent window when an event has occurred or the control requires some information. 
			/// </summary>
			NOTIFY = 0x004E,
			/// <summary>
			/// The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately. 
			/// </summary>
			INPUTLANGCHANGEREQUEST = 0x0050,
			/// <summary>
			/// The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on. 
			/// </summary>
			INPUTLANGCHANGE = 0x0051,
			/// <summary>
			/// Sent to an application that has initiated a training card with Microsoft Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function.
			/// </summary>
			TCARD = 0x0052,
			/// <summary>
			/// Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window. 
			/// </summary>
			HELP = 0x0053,
			/// <summary>
			/// The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings.
			/// </summary>
			USERCHANGED = 0x0054,
			/// <summary>
			/// Determines if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control.
			/// </summary>
			NOTIFYFORMAT = 0x0055,
			/// <summary>
			/// The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right-clicked) in the window.
			/// </summary>
			CONTEXTMENU = 0x007B,
			/// <summary>
			/// The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.
			/// </summary>
			STYLECHANGING = 0x007C,
			/// <summary>
			/// The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles
			/// </summary>
			STYLECHANGED = 0x007D,
			/// <summary>
			/// The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
			/// </summary>
			DISPLAYCHANGE = 0x007E,
			/// <summary>
			/// The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption. 
			/// </summary>
			GETICON = 0x007F,
			/// <summary>
			/// An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption. 
			/// </summary>
			SETICON = 0x0080,
			/// <summary>
			/// The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.
			/// </summary>
			NCCREATE = 0x0081,
			/// <summary>
			/// The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window. 
			/// The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast, WM_DESTROY is sent before the child windows are destroyed.
			/// </summary>
			NCDESTROY = 0x0082,
			/// <summary>
			/// The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes.
			/// </summary>
			NCCALCSIZE = 0x0083,
			/// <summary>
			/// The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.
			/// </summary>
			NCHITTEST = 0x0084,
			/// <summary>
			/// The WM_NCPAINT message is sent to a window when its frame must be painted. 
			/// </summary>
			NCPAINT = 0x0085,
			/// <summary>
			/// The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state.
			/// </summary>
			NCACTIVATE = 0x0086,
			/// <summary>
			/// The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
			/// </summary>
			GETDLGCODE = 0x0087,
			/// <summary>
			/// The WM_SYNCPAINT message is used to synchronize painting while avoiding linking independent GUI threads.
			/// </summary>
			SYNCPAINT = 0x0088,
			/// <summary>
			/// The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMOUSEMOVE = 0x00A0,
			/// <summary>
			/// The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCLBUTTONDOWN = 0x00A1,
			/// <summary>
			/// The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCLBUTTONUP = 0x00A2,
			/// <summary>
			/// The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCLBUTTONDBLCLK = 0x00A3,
			/// <summary>
			/// The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCRBUTTONDOWN = 0x00A4,
			/// <summary>
			/// The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCRBUTTONUP = 0x00A5,
			/// <summary>
			/// The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCRBUTTONDBLCLK = 0x00A6,
			/// <summary>
			/// The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMBUTTONDOWN = 0x00A7,
			/// <summary>
			/// The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMBUTTONUP = 0x00A8,
			/// <summary>
			/// The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCMBUTTONDBLCLK = 0x00A9,
			/// <summary>
			/// The WM_NCXBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCXBUTTONDOWN = 0x00AB,
			/// <summary>
			/// The WM_NCXBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCXBUTTONUP = 0x00AC,
			/// <summary>
			/// The WM_NCXBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
			/// </summary>
			NCXBUTTONDBLCLK = 0x00AD,
			/// <summary>
			/// The WM_INPUT_DEVICE_CHANGE message is sent to the window that registered to receive raw input. A window receives this message through its WindowProc function.
			/// </summary>
			INPUT_DEVICE_CHANGE = 0x00FE,
			/// <summary>
			/// The WM_INPUT message is sent to the window that is getting raw input. 
			/// </summary>
			INPUT = 0x00FF,
			/// <summary>
			/// This message filters for keyboard messages.
			/// </summary>
			KEYFIRST = 0x0100,
			/// <summary>
			/// The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. 
			/// </summary>
			KEYDOWN = 0x0100,
			/// <summary>
			/// The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus. 
			/// </summary>
			KEYUP = 0x0101,
			/// <summary>
			/// The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed. 
			/// </summary>
			CHAR = 0x0102,
			/// <summary>
			/// The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key. 
			/// </summary>
			DEADCHAR = 0x0103,
			/// <summary>
			/// The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. 
			/// </summary>
			SYSKEYDOWN = 0x0104,
			/// <summary>
			/// The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. 
			/// </summary>
			SYSKEYUP = 0x0105,
			/// <summary>
			/// The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down. 
			/// </summary>
			SYSCHAR = 0x0106,
			/// <summary>
			/// The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the ALT key. 
			/// </summary>
			SYSDEADCHAR = 0x0107,
			/// <summary>
			/// The WM_UNICHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_UNICHAR message contains the character code of the key that was pressed. 
			/// The WM_UNICHAR message is equivalent to WM_CHAR, but it uses Unicode Transformation Format (UTF)-32, whereas WM_CHAR uses UTF-16. It is designed to send or post Unicode characters to ANSI windows and it can can handle Unicode Supplementary Plane characters.
			/// </summary>
			UNICHAR = 0x0109,
			/// <summary>
			/// This message filters for keyboard messages.
			/// </summary>
			KEYLAST = 0x0109,
			/// <summary>
			/// Sent immediately before the IME generates the composition string as a result of a keystroke. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_STARTCOMPOSITION = 0x010D,
			/// <summary>
			/// Sent to an application when the IME ends composition. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_ENDCOMPOSITION = 0x010E,
			/// <summary>
			/// Sent to an application when the IME changes composition status as a result of a keystroke. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_COMPOSITION = 0x010F,
			IME_KEYLAST = 0x010F,
			/// <summary>
			/// The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box. 
			/// </summary>
			INITDIALOG = 0x0110,
			/// <summary>
			/// The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated. 
			/// </summary>
			COMMAND = 0x0111,
			/// <summary>
			/// A window receives this message when the user chooses a command from the Window menu, clicks the maximize button, minimize button, restore button, close button, or moves the form. You can stop the form from moving by filtering this out.
			/// </summary>
			SYSCOMMAND = 0x0112,
			/// <summary>
			/// The WM_TIMER message is posted to the installing thread's message queue when a timer expires. The message is posted by the GetMessage or PeekMessage function. 
			/// </summary>
			TIMER = 0x0113,
			/// <summary>
			/// The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control. 
			/// </summary>
			HSCROLL = 0x0114,
			/// <summary>
			/// The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control. 
			/// </summary>
			VSCROLL = 0x0115,
			/// <summary>
			/// The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed. 
			/// </summary>
			INITMENU = 0x0116,
			/// <summary>
			/// The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu. 
			/// </summary>
			INITMENUPOPUP = 0x0117,
			/// <summary>
			/// The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item. 
			/// </summary>
			MENUSELECT = 0x011F,
			/// <summary>
			/// The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu. 
			/// </summary>
			MENUCHAR = 0x0120,
			/// <summary>
			/// The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages. 
			/// </summary>
			ENTERIDLE = 0x0121,
			/// <summary>
			/// The WM_MENURBUTTONUP message is sent when the user releases the right mouse button while the cursor is on a menu item. 
			/// </summary>
			MENURBUTTONUP = 0x0122,
			/// <summary>
			/// The WM_MENUDRAG message is sent to the owner of a drag-and-drop menu when the user drags a menu item. 
			/// </summary>
			MENUDRAG = 0x0123,
			/// <summary>
			/// The WM_MENUGETOBJECT message is sent to the owner of a drag-and-drop menu when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item. 
			/// </summary>
			MENUGETOBJECT = 0x0124,
			/// <summary>
			/// The WM_UNINITMENUPOPUP message is sent when a drop-down menu or submenu has been destroyed. 
			/// </summary>
			UNINITMENUPOPUP = 0x0125,
			/// <summary>
			/// The WM_MENUCOMMAND message is sent when the user makes a selection from a menu. 
			/// </summary>
			MENUCOMMAND = 0x0126,
			/// <summary>
			/// An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed.
			/// </summary>
			CHANGEUISTATE = 0x0127,
			/// <summary>
			/// An application sends the WM_UPDATEUISTATE message to change the user interface (UI) state for the specified window and all its child windows.
			/// </summary>
			UPDATEUISTATE = 0x0128,
			/// <summary>
			/// An application sends the WM_QUERYUISTATE message to retrieve the user interface (UI) state for a window.
			/// </summary>
			QUERYUISTATE = 0x0129,
			/// <summary>
			/// The WM_CTLCOLORMSGBOX message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the given display device context handle. 
			/// </summary>
			CTLCOLORMSGBOX = 0x0132,
			/// <summary>
			/// An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control. 
			/// </summary>
			CTLCOLOREDIT = 0x0133,
			/// <summary>
			/// Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle. 
			/// </summary>
			CTLCOLORLISTBOX = 0x0134,
			/// <summary>
			/// The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message. 
			/// </summary>
			CTLCOLORBTN = 0x0135,
			/// <summary>
			/// The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle. 
			/// </summary>
			CTLCOLORDLG = 0x0136,
			/// <summary>
			/// The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control. 
			/// </summary>
			CTLCOLORSCROLLBAR = 0x0137,
			/// <summary>
			/// A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control. 
			/// </summary>
			CTLCOLORSTATIC = 0x0138,
			/// <summary>
			/// Use WM_MOUSEFIRST to specify the first mouse message. Use the PeekMessage() Function.
			/// </summary>
			MOUSEFIRST = 0x0200,
			/// <summary>
			/// The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MOUSEMOVE = 0x0200,
			/// <summary>
			/// The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			LBUTTONDOWN = 0x0201,
			/// <summary>
			/// The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			LBUTTONUP = 0x0202,
			/// <summary>
			/// The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			LBUTTONDBLCLK = 0x0203,
			/// <summary>
			/// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			RBUTTONDOWN = 0x0204,
			/// <summary>
			/// The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			RBUTTONUP = 0x0205,
			/// <summary>
			/// The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			RBUTTONDBLCLK = 0x0206,
			/// <summary>
			/// The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MBUTTONDOWN = 0x0207,
			/// <summary>
			/// The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MBUTTONUP = 0x0208,
			/// <summary>
			/// The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			MBUTTONDBLCLK = 0x0209,
			/// <summary>
			/// The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
			/// </summary>
			MOUSEWHEEL = 0x020A,
			/// <summary>
			/// The WM_XBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
			/// </summary>
			XBUTTONDOWN = 0x020B,
			/// <summary>
			/// The WM_XBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			XBUTTONUP = 0x020C,
			/// <summary>
			/// The WM_XBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
			/// </summary>
			XBUTTONDBLCLK = 0x020D,
			/// <summary>
			/// The WM_MOUSEHWHEEL message is sent to the focus window when the mouse's horizontal scroll wheel is tilted or rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
			/// </summary>
			MOUSEHWHEEL = 0x020E,
			/// <summary>
			/// Use WM_MOUSELAST to specify the last mouse message. Used with PeekMessage() Function.
			/// </summary>
			MOUSELAST = 0x020E,
			/// <summary>
			/// The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place.
			/// </summary>
			PARENTNOTIFY = 0x0210,
			/// <summary>
			/// The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered. 
			/// </summary>
			ENTERMENULOOP = 0x0211,
			/// <summary>
			/// The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited. 
			/// </summary>
			EXITMENULOOP = 0x0212,
			/// <summary>
			/// The WM_NEXTMENU message is sent to an application when the right or left arrow key is used to switch between the menu bar and the system menu. 
			/// </summary>
			NEXTMENU = 0x0213,
			/// <summary>
			/// The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position. 
			/// </summary>
			SIZING = 0x0214,
			/// <summary>
			/// The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.
			/// </summary>
			CAPTURECHANGED = 0x0215,
			/// <summary>
			/// The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position.
			/// </summary>
			MOVING = 0x0216,
			/// <summary>
			/// Notifies applications that a power-management event has occurred.
			/// </summary>
			POWERBROADCAST = 0x0218,
			/// <summary>
			/// Notifies an application of a change to the hardware configuration of a device or the computer.
			/// </summary>
			DEVICECHANGE = 0x0219,
			/// <summary>
			/// An application sends the WM_MDICREATE message to a multiple-document interface (MDI) client window to create an MDI child window. 
			/// </summary>
			MDICREATE = 0x0220,
			/// <summary>
			/// An application sends the WM_MDIDESTROY message to a multiple-document interface (MDI) client window to close an MDI child window. 
			/// </summary>
			MDIDESTROY = 0x0221,
			/// <summary>
			/// An application sends the WM_MDIACTIVATE message to a multiple-document interface (MDI) client window to instruct the client window to activate a different MDI child window. 
			/// </summary>
			MDIACTIVATE = 0x0222,
			/// <summary>
			/// An application sends the WM_MDIRESTORE message to a multiple-document interface (MDI) client window to restore an MDI child window from maximized or minimized size. 
			/// </summary>
			MDIRESTORE = 0x0223,
			/// <summary>
			/// An application sends the WM_MDINEXT message to a multiple-document interface (MDI) client window to activate the next or previous child window. 
			/// </summary>
			MDINEXT = 0x0224,
			/// <summary>
			/// An application sends the WM_MDIMAXIMIZE message to a multiple-document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window. 
			/// </summary>
			MDIMAXIMIZE = 0x0225,
			/// <summary>
			/// An application sends the WM_MDITILE message to a multiple-document interface (MDI) client window to arrange all of its MDI child windows in a tile format. 
			/// </summary>
			MDITILE = 0x0226,
			/// <summary>
			/// An application sends the WM_MDICASCADE message to a multiple-document interface (MDI) client window to arrange all its child windows in a cascade format. 
			/// </summary>
			MDICASCADE = 0x0227,
			/// <summary>
			/// An application sends the WM_MDIICONARRANGE message to a multiple-document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized. 
			/// </summary>
			MDIICONARRANGE = 0x0228,
			/// <summary>
			/// An application sends the WM_MDIGETACTIVE message to a multiple-document interface (MDI) client window to retrieve the handle to the active MDI child window. 
			/// </summary>
			MDIGETACTIVE = 0x0229,
			/// <summary>
			/// An application sends the WM_MDISETMENU message to a multiple-document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the window menu of the frame window, or both. 
			/// </summary>
			MDISETMENU = 0x0230,
			/// <summary>
			/// The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
			/// The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled.
			/// </summary>
			ENTERSIZEMOVE = 0x0231,
			/// <summary>
			/// The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
			/// </summary>
			EXITSIZEMOVE = 0x0232,
			/// <summary>
			/// Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files.
			/// </summary>
			DROPFILES = 0x0233,
			/// <summary>
			/// An application sends the WM_MDIREFRESHMENU message to a multiple-document interface (MDI) client window to refresh the window menu of the MDI frame window. 
			/// </summary>
			MDIREFRESHMENU = 0x0234,
			/// <summary>
			/// Sent to an application when a window is activated. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_SETCONTEXT = 0x0281,
			/// <summary>
			/// Sent to an application to notify it of changes to the IME window. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_NOTIFY = 0x0282,
			/// <summary>
			/// Sent by an application to direct the IME window to carry out the requested command. The application uses this message to control the IME window that it has created. To send this message, the application calls the SendMessage function with the following parameters.
			/// </summary>
			IME_CONTROL = 0x0283,
			/// <summary>
			/// Sent to an application when the IME window finds no space to extend the area for the composition window. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_COMPOSITIONFULL = 0x0284,
			/// <summary>
			/// Sent to an application when the operating system is about to change the current IME. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_SELECT = 0x0285,
			/// <summary>
			/// Sent to an application when the IME gets a character of the conversion result. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_CHAR = 0x0286,
			/// <summary>
			/// Sent to an application to provide commands and request information. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_REQUEST = 0x0288,
			/// <summary>
			/// Sent to an application by the IME to notify the application of a key press and to keep message order. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_KEYDOWN = 0x0290,
			/// <summary>
			/// Sent to an application by the IME to notify the application of a key release and to keep message order. A window receives this message through its WindowProc function. 
			/// </summary>
			IME_KEYUP = 0x0291,
			/// <summary>
			/// The WM_MOUSEHOVER message is posted to a window when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent.
			/// </summary>
			MOUSEHOVER = 0x02A1,
			/// <summary>
			/// The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
			/// </summary>
			MOUSELEAVE = 0x02A3,
			/// <summary>
			/// The WM_NCMOUSEHOVER message is posted to a window when the cursor hovers over the nonclient area of the window for the period of time specified in a prior call to TrackMouseEvent.
			/// </summary>
			NCMOUSEHOVER = 0x02A0,
			/// <summary>
			/// The WM_NCMOUSELEAVE message is posted to a window when the cursor leaves the nonclient area of the window specified in a prior call to TrackMouseEvent.
			/// </summary>
			NCMOUSELEAVE = 0x02A2,
			/// <summary>
			/// The WM_WTSSESSION_CHANGE message notifies applications of changes in session state.
			/// </summary>
			WTSSESSION_CHANGE = 0x02B1,
			TABLET_FIRST = 0x02c0,
			TABLET_LAST = 0x02df,
			/// <summary>
			/// An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format. 
			/// </summary>
			CUT = 0x0300,
			/// <summary>
			/// An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format. 
			/// </summary>
			COPY = 0x0301,
			/// <summary>
			/// An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format. 
			/// </summary>
			PASTE = 0x0302,
			/// <summary>
			/// An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control. 
			/// </summary>
			CLEAR = 0x0303,
			/// <summary>
			/// An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted.
			/// </summary>
			UNDO = 0x0304,
			/// <summary>
			/// The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function. 
			/// </summary>
			RENDERFORMAT = 0x0305,
			/// <summary>
			/// The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function. 
			/// </summary>
			RENDERALLFORMATS = 0x0306,
			/// <summary>
			/// The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard. 
			/// </summary>
			DESTROYCLIPBOARD = 0x0307,
			/// <summary>
			/// The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard. 
			/// </summary>
			DRAWCLIPBOARD = 0x0308,
			/// <summary>
			/// The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting. 
			/// </summary>
			PAINTCLIPBOARD = 0x0309,
			/// <summary>
			/// The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
			/// </summary>
			VSCROLLCLIPBOARD = 0x030A,
			/// <summary>
			/// The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size. 
			/// </summary>
			SIZECLIPBOARD = 0x030B,
			/// <summary>
			/// The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.
			/// </summary>
			ASKCBFORMATNAME = 0x030C,
			/// <summary>
			/// The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain. 
			/// </summary>
			CHANGECBCHAIN = 0x030D,
			/// <summary>
			/// The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
			/// </summary>
			HSCROLLCLIPBOARD = 0x030E,
			/// <summary>
			/// This message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus. 
			/// </summary>
			QUERYNEWPALETTE = 0x030F,
			/// <summary>
			/// The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette. 
			/// </summary>
			PALETTEISCHANGING = 0x0310,
			/// <summary>
			/// This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette. 
			/// This message enables windows that do not have the keyboard focus to realize their logical palettes and update their client areas.
			/// </summary>
			PALETTECHANGED = 0x0311,
			/// <summary>
			/// The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key. 
			/// </summary>
			HOTKEY = 0x0312,
			/// <summary>
			/// The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.
			/// </summary>
			PRINT = 0x0317,
			/// <summary>
			/// The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.
			/// </summary>
			PRINTCLIENT = 0x0318,
			/// <summary>
			/// The WM_APPCOMMAND message notifies a window that the user generated an application command event, for example, by clicking an application command button using the mouse or typing an application command key on the keyboard.
			/// </summary>
			APPCOMMAND = 0x0319,
			/// <summary>
			/// The WM_THEMECHANGED message is broadcast to every window following a theme change event. Examples of theme change events are the activation of a theme, the deactivation of a theme, or a transition from one theme to another.
			/// </summary>
			THEMECHANGED = 0x031A,
			/// <summary>
			/// Sent when the contents of the clipboard have changed.
			/// </summary>
			CLIPBOARDUPDATE = 0x031D,
			/// <summary>
			/// The system will send a window the WM_DWMCOMPOSITIONCHANGED message to indicate that the availability of desktop composition has changed.
			/// </summary>
			DWMCOMPOSITIONCHANGED = 0x031E,
			/// <summary>
			/// WM_DWMNCRENDERINGCHANGED is called when the non-client area rendering status of a window has changed. Only windows that have set the flag DWM_BLURBEHIND.fTransitionOnMaximized to true will get this message. 
			/// </summary>
			DWMNCRENDERINGCHANGED = 0x031F,
			/// <summary>
			/// Sent to all top-level windows when the colorization color has changed. 
			/// </summary>
			DWMCOLORIZATIONCOLORCHANGED = 0x0320,
			/// <summary>
			/// WM_DWMWINDOWMAXIMIZEDCHANGE will let you know when a DWM composed window is maximized. You also have to register for this message as well. You'd have other windowd go opaque when this message is sent.
			/// </summary>
			DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
			/// <summary>
			/// Sent to request extended title bar information. A window receives this message through its WindowProc function.
			/// </summary>
			GETTITLEBARINFOEX = 0x033F,
			HANDHELDFIRST = 0x0358,
			HANDHELDLAST = 0x035F,
			AFXFIRST = 0x0360,
			AFXLAST = 0x037F,
			PENWINFIRST = 0x0380,
			PENWINLAST = 0x038F,
			/// <summary>
			/// The WM_APP constant is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value. 
			/// </summary>
			APP = 0x8000,
			/// <summary>
			/// The WM_USER constant is used by applications to help define private messages for use by private window classes, usually of the form WM_USER+X, where X is an integer value. 
			/// </summary>
			USER = 0x0400,

			/// <summary>
			/// An application sends the WM_CPL_LAUNCH message to Windows Control Panel to request that a Control Panel application be started. 
			/// </summary>
			CPL_LAUNCH = USER + 0x1000,
			/// <summary>
			/// The WM_CPL_LAUNCHED message is sent when a Control Panel application, started by the WM_CPL_LAUNCH message, has closed. The WM_CPL_LAUNCHED message is sent to the window identified by the wParam parameter of the WM_CPL_LAUNCH message that started the application. 
			/// </summary>
			CPL_LAUNCHED = USER + 0x1001,
			/// <summary>
			/// WM_SYSTIMER is a well-known yet still undocumented message. Windows uses WM_SYSTIMER for internal actions like scrolling.
			/// </summary>
			SYSTIMER = 0x118
		}

        [DllImport("user32.dll", SetLastError = true)]
		private static extern IntPtr SetWindowsHookEx(HookType hookType, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId);
		[DllImport("user32.dll")]
		private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, WM wParam, ref MSLLHOOKSTRUCT lParam);
        [DllImport( "user32.dll", SetLastError = true )]
        private static extern bool UnhookWindowsHookEx( IntPtr hhk );
        [DllImport( "kernel32.dll", SetLastError = true )]
        private static extern IntPtr GetModuleHandle( IntPtr lpModuleName );

		private delegate IntPtr LowLevelMouseProc(int code, WM wParam, ref MSLLHOOKSTRUCT lParam);

        private enum HookType : int
        {
            WH_JOURNALRECORD = 0,
            WH_JOURNALPLAYBACK = 1,
            WH_KEYBOARD = 2,
            WH_GETMESSAGE = 3,
            WH_CALLWNDPROC = 4,
            WH_CBT = 5,
            WH_SYSMSGFILTER = 6,
            WH_MOUSE = 7,
            WH_HARDWARE = 8,
            WH_DEBUG = 9,
            WH_SHELL = 10,
            WH_FOREGROUNDIDLE = 11,
            WH_CALLWNDPROCRET = 12,
            WH_KEYBOARD_LL = 13,
            WH_MOUSE_LL = 14
        }

		[StructLayout(LayoutKind.Sequential)]
		private struct POINT
		{
			public int x;
			public int y;
		}

		[StructLayout(LayoutKind.Sequential)]
		private struct MSLLHOOKSTRUCT
		{
			public POINT pt;
			public uint mouseData;
			public uint flags;
			public uint time;
			public UIntPtr dwExtraInfo;
		}


	}
}

Open in new window

0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35189149
Good catch, Windows 7 seems not to care but definitely need the hMod under XP.

Also, you reminded me that I forgot to mention a couple of the DllImport's were wrong at www.pinvoke.net, so better to copy'em from above rather than over there.
0
 
LVL 14

Expert Comment

by:systan
ID: 35193249
hi folks;
lots of talks here.
iS this solved? or not yeT?
0
 
LVL 18

Assisted Solution

by:Richard Lee
Richard Lee earned 0 total points
ID: 35196714
Thanks to tgerbert & Dan7el. I have successfully implemented the solution however I have had to make a slight modification to handle the following error:

"CallbackOnCollectedDelegate was detected
Message: A callback was made on a garbage collected delegate of type 'MouseHook+LowLevelMouseProc::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called."

This is caused by by the following line of code:

_hookResponse = SetWindowsHookEx(HookType.WH_MOUSE_LL, MouseProc, iptrNull, 0);

I have simply avoided early garbage collection by introducing a class field:

private readonly LowLevelMouseProc _mouseCallbackProc;

public MouseHook()
{
      _mouseCallbackProc = MouseProc;
}

....

_hookResponse = SetWindowsHookEx(HookType.WH_MOUSE_LL, _mouseCallbackProc, iptrNull, 0);

Updated code attached

DaTribe
private const string XY = "x = {0}, y = {1}";
private volatile MouseHook mh;

public Form1()
{
	InitializeComponent();
			
	mh = new MouseHook();
	mh.MouseMovement += mh_MouseMovement;
	mh.StartMouseHook();
}

void mh_MouseMovement(object sender, MouseHookEventArgs e)
{
	StringBuilder sb = new StringBuilder();
	sb.AppendFormat(XY, e.X, e.Y);
	ToolStripGlobalPosition.Text = sb.ToString();
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
	mh.Dispose();
}

Open in new window

public class MouseHookEventArgs : EventArgs
{
	public int X { get; private set; }
	public int Y { get; private set; }
	public MouseHookEventArgs(int X, int Y)
	{
		this.X = X;
		this.Y = Y;
	}
}

public class MouseHook : IDisposable
{
	[DllImport("user32.dll", SetLastError = true)]
	private static extern IntPtr SetWindowsHookEx(HookType hookType, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId);

	[DllImport("user32.dll")]
	private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, WM wParam, ref MSLLHOOKSTRUCT lParam);

	[DllImport("user32.dll", SetLastError = true)]
	private static extern bool UnhookWindowsHookEx(IntPtr hhk);

	[DllImport("kernel32.dll", SetLastError = true)]
	private static extern IntPtr GetModuleHandle(IntPtr lpModuleName);

	private delegate IntPtr LowLevelMouseProc(int code, WM wParam, ref MSLLHOOKSTRUCT lParam);
	public delegate void MouseHookEventHandler(object sender, MouseHookEventArgs e);

	private bool _disposed = false;
	private IntPtr _hookResponse = IntPtr.Zero;
		
	public event MouseHookEventHandler MouseMovement;
	private readonly LowLevelMouseProc _mouseCallbackProc;

	#region C'tor & D'tor

	public MouseHook()
	{
		_mouseCallbackProc = MouseProc;
	}

	~MouseHook()
	{
		Dispose(false);
	}

	#endregion

	#region IDisposable & Helpers

	public void Dispose()
	{
		Dispose(true);
		GC.SuppressFinalize(this);
	}

	private void Dispose(bool disposing)
	{
		if (!_disposed)
		{
			_disposed = true;
			StopMouseHook(false);
		}
	}

	#endregion

	protected virtual void OnMouseMovement(MouseHookEventArgs e)
	{
		if (MouseMovement != null)
			MouseMovement(this, e);
	}

	private IntPtr MouseProc(int code, WM wParam, ref MSLLHOOKSTRUCT lParam)
	{
		// MSDN says only process msg if code >= 0, and filter for movement events
		if (code >= 0 && wParam == WM.MOUSEMOVE)
		{
			// Raise our mousemovement event
			OnMouseMovement(new MouseHookEventArgs(lParam.pt.x, lParam.pt.y));
		}

		return CallNextHookEx(IntPtr.Zero, code, wParam, ref lParam);
	}

	public void StartMouseHook()
	{
		// Insert global low-level mouse hook, tell Windows to call our mouseProc method
		IntPtr iptrNull = GetModuleHandle(IntPtr.Zero);
		_hookResponse = SetWindowsHookEx(HookType.WH_MOUSE_LL, _mouseCallbackProc, iptrNull, 0);

		int error = Marshal.GetLastWin32Error();
		if (error != 0)
			throw new Win32Exception(error);
	}

	public void StopMouseHook()
	{
		StopMouseHook(true);
	}

	private void StopMouseHook(bool throwExceptionOnError)
	{
		if (_hookResponse != IntPtr.Zero)
		{
			bool success = UnhookWindowsHookEx(_hookResponse);
			if (!success && throwExceptionOnError)
				throw new Win32Exception(Marshal.GetLastWin32Error());
		}
	}

	/// <summary>
	/// Windows Messages
	/// Defined in winuser.h from Windows SDK v6.1
	/// Documentation pulled from MSDN.
	/// </summary>
	public enum WM : uint
	{
		/// <summary>
		/// The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.
		/// </summary>
		NULL = 0x0000,
		/// <summary>
		/// The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible.
		/// </summary>
		CREATE = 0x0001,
		/// <summary>
		/// The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. 
		/// This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist.
		/// /// </summary>
		DESTROY = 0x0002,
		/// <summary>
		/// The WM_MOVE message is sent after a window has been moved. 
		/// </summary>
		MOVE = 0x0003,
		/// <summary>
		/// The WM_SIZE message is sent to a window after its size has changed.
		/// </summary>
		SIZE = 0x0005,
		/// <summary>
		/// The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately. 
		/// </summary>
		ACTIVATE = 0x0006,
		/// <summary>
		/// The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. 
		/// </summary>
		SETFOCUS = 0x0007,
		/// <summary>
		/// The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. 
		/// </summary>
		KILLFOCUS = 0x0008,
		/// <summary>
		/// The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. 
		/// </summary>
		ENABLE = 0x000A,
		/// <summary>
		/// An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn. 
		/// </summary>
		SETREDRAW = 0x000B,
		/// <summary>
		/// An application sends a WM_SETTEXT message to set the text of a window. 
		/// </summary>
		SETTEXT = 0x000C,
		/// <summary>
		/// An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller. 
		/// </summary>
		GETTEXT = 0x000D,
		/// <summary>
		/// An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window. 
		/// </summary>
		GETTEXTLENGTH = 0x000E,
		/// <summary>
		/// The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function. 
		/// </summary>
		PAINT = 0x000F,
		/// <summary>
		/// The WM_CLOSE message is sent as a signal that a window or an application should terminate.
		/// </summary>
		CLOSE = 0x0010,
		/// <summary>
		/// The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
		/// After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
		/// </summary>
		QUERYENDSESSION = 0x0011,
		/// <summary>
		/// The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position.
		/// </summary>
		QUERYOPEN = 0x0013,
		/// <summary>
		/// The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending.
		/// </summary>
		ENDSESSION = 0x0016,
		/// <summary>
		/// The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero.
		/// </summary>
		QUIT = 0x0012,
		/// <summary>
		/// The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting. 
		/// </summary>
		ERASEBKGND = 0x0014,
		/// <summary>
		/// This message is sent to all top-level windows when a change is made to a system color setting. 
		/// </summary>
		SYSCOLORCHANGE = 0x0015,
		/// <summary>
		/// The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
		/// </summary>
		SHOWWINDOW = 0x0018,
		/// <summary>
		/// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
		/// Note  The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
		/// </summary>
		WININICHANGE = 0x001A,
		/// <summary>
		/// An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
		/// Note  The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
		/// </summary>
		SETTINGCHANGE = WM.WININICHANGE,
		/// <summary>
		/// The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings. 
		/// </summary>
		DEVMODECHANGE = 0x001B,
		/// <summary>
		/// The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.
		/// </summary>
		ACTIVATEAPP = 0x001C,
		/// <summary>
		/// An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources. 
		/// </summary>
		FONTCHANGE = 0x001D,
		/// <summary>
		/// A message that is sent whenever there is a change in the system time.
		/// </summary>
		TIMECHANGE = 0x001E,
		/// <summary>
		/// The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.
		/// </summary>
		CANCELMODE = 0x001F,
		/// <summary>
		/// The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured. 
		/// </summary>
		SETCURSOR = 0x0020,
		/// <summary>
		/// The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function.
		/// </summary>
		MOUSEACTIVATE = 0x0021,
		/// <summary>
		/// The WM_CHILDACTIVATE message is sent to a child window when the user clicks the window's title bar or when the window is activated, moved, or sized.
		/// </summary>
		CHILDACTIVATE = 0x0022,
		/// <summary>
		/// The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK Hook procedure. 
		/// </summary>
		QUEUESYNC = 0x0023,
		/// <summary>
		/// The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size. 
		/// </summary>
		GETMINMAXINFO = 0x0024,
		/// <summary>
		/// Windows NT 3.51 and earlier: The WM_PAINTICON message is sent to a minimized window when the icon is to be painted. This message is not sent by newer versions of Microsoft Windows, except in unusual circumstances explained in the Remarks.
		/// </summary>
		PAINTICON = 0x0026,
		/// <summary>
		/// Windows NT 3.51 and earlier: The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. This message is not sent by newer versions of Windows.
		/// </summary>
		ICONERASEBKGND = 0x0027,
		/// <summary>
		/// The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box. 
		/// </summary>
		NEXTDLGCTL = 0x0028,
		/// <summary>
		/// The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue. 
		/// </summary>
		SPOOLERSTATUS = 0x002A,
		/// <summary>
		/// The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
		/// </summary>
		DRAWITEM = 0x002B,
		/// <summary>
		/// The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.
		/// </summary>
		MEASUREITEM = 0x002C,
		/// <summary>
		/// Sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.
		/// </summary>
		DELETEITEM = 0x002D,
		/// <summary>
		/// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message. 
		/// </summary>
		VKEYTOITEM = 0x002E,
		/// <summary>
		/// Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message. 
		/// </summary>
		CHARTOITEM = 0x002F,
		/// <summary>
		/// An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text. 
		/// </summary>
		SETFONT = 0x0030,
		/// <summary>
		/// An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text. 
		/// </summary>
		GETFONT = 0x0031,
		/// <summary>
		/// An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window. 
		/// </summary>
		SETHOTKEY = 0x0032,
		/// <summary>
		/// An application sends a WM_GETHOTKEY message to determine the hot key associated with a window. 
		/// </summary>
		GETHOTKEY = 0x0033,
		/// <summary>
		/// The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon.
		/// </summary>
		QUERYDRAGICON = 0x0037,
		/// <summary>
		/// The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style. 
		/// </summary>
		COMPAREITEM = 0x0039,
		/// <summary>
		/// Active Accessibility sends the WM_GETOBJECT message to obtain information about an accessible object contained in a server application. 
		/// Applications never send this message directly. It is sent only by Active Accessibility in response to calls to AccessibleObjectFromPoint, AccessibleObjectFromEvent, or AccessibleObjectFromWindow. However, server applications handle this message. 
		/// </summary>
		GETOBJECT = 0x003D,
		/// <summary>
		/// The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low.
		/// </summary>
		COMPACTING = 0x0041,
		/// <summary>
		/// WM_COMMNOTIFY is Obsolete for Win32-Based Applications
		/// </summary>
		[Obsolete]
		COMMNOTIFY = 0x0044,
		/// <summary>
		/// The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.
		/// </summary>
		WINDOWPOSCHANGING = 0x0046,
		/// <summary>
		/// The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function.
		/// </summary>
		WINDOWPOSCHANGED = 0x0047,
		/// <summary>
		/// Notifies applications that the system, typically a battery-powered personal computer, is about to enter a suspended mode.
		/// Use: POWERBROADCAST
		/// </summary>
		[Obsolete]
		POWER = 0x0048,
		/// <summary>
		/// An application sends the WM_COPYDATA message to pass data to another application. 
		/// </summary>
		COPYDATA = 0x004A,
		/// <summary>
		/// The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle. 
		/// </summary>
		CANCELJOURNAL = 0x004B,
		/// <summary>
		/// Sent by a common control to its parent window when an event has occurred or the control requires some information. 
		/// </summary>
		NOTIFY = 0x004E,
		/// <summary>
		/// The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately. 
		/// </summary>
		INPUTLANGCHANGEREQUEST = 0x0050,
		/// <summary>
		/// The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on. 
		/// </summary>
		INPUTLANGCHANGE = 0x0051,
		/// <summary>
		/// Sent to an application that has initiated a training card with Microsoft Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function.
		/// </summary>
		TCARD = 0x0052,
		/// <summary>
		/// Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window. 
		/// </summary>
		HELP = 0x0053,
		/// <summary>
		/// The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings.
		/// </summary>
		USERCHANGED = 0x0054,
		/// <summary>
		/// Determines if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control.
		/// </summary>
		NOTIFYFORMAT = 0x0055,
		/// <summary>
		/// The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right-clicked) in the window.
		/// </summary>
		CONTEXTMENU = 0x007B,
		/// <summary>
		/// The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.
		/// </summary>
		STYLECHANGING = 0x007C,
		/// <summary>
		/// The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles
		/// </summary>
		STYLECHANGED = 0x007D,
		/// <summary>
		/// The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
		/// </summary>
		DISPLAYCHANGE = 0x007E,
		/// <summary>
		/// The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption. 
		/// </summary>
		GETICON = 0x007F,
		/// <summary>
		/// An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption. 
		/// </summary>
		SETICON = 0x0080,
		/// <summary>
		/// The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.
		/// </summary>
		NCCREATE = 0x0081,
		/// <summary>
		/// The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window. 
		/// The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast, WM_DESTROY is sent before the child windows are destroyed.
		/// </summary>
		NCDESTROY = 0x0082,
		/// <summary>
		/// The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes.
		/// </summary>
		NCCALCSIZE = 0x0083,
		/// <summary>
		/// The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.
		/// </summary>
		NCHITTEST = 0x0084,
		/// <summary>
		/// The WM_NCPAINT message is sent to a window when its frame must be painted. 
		/// </summary>
		NCPAINT = 0x0085,
		/// <summary>
		/// The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state.
		/// </summary>
		NCACTIVATE = 0x0086,
		/// <summary>
		/// The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
		/// </summary>
		GETDLGCODE = 0x0087,
		/// <summary>
		/// The WM_SYNCPAINT message is used to synchronize painting while avoiding linking independent GUI threads.
		/// </summary>
		SYNCPAINT = 0x0088,
		/// <summary>
		/// The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCMOUSEMOVE = 0x00A0,
		/// <summary>
		/// The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCLBUTTONDOWN = 0x00A1,
		/// <summary>
		/// The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCLBUTTONUP = 0x00A2,
		/// <summary>
		/// The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCLBUTTONDBLCLK = 0x00A3,
		/// <summary>
		/// The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCRBUTTONDOWN = 0x00A4,
		/// <summary>
		/// The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCRBUTTONUP = 0x00A5,
		/// <summary>
		/// The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCRBUTTONDBLCLK = 0x00A6,
		/// <summary>
		/// The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCMBUTTONDOWN = 0x00A7,
		/// <summary>
		/// The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCMBUTTONUP = 0x00A8,
		/// <summary>
		/// The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCMBUTTONDBLCLK = 0x00A9,
		/// <summary>
		/// The WM_NCXBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCXBUTTONDOWN = 0x00AB,
		/// <summary>
		/// The WM_NCXBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCXBUTTONUP = 0x00AC,
		/// <summary>
		/// The WM_NCXBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
		/// </summary>
		NCXBUTTONDBLCLK = 0x00AD,
		/// <summary>
		/// The WM_INPUT_DEVICE_CHANGE message is sent to the window that registered to receive raw input. A window receives this message through its WindowProc function.
		/// </summary>
		INPUT_DEVICE_CHANGE = 0x00FE,
		/// <summary>
		/// The WM_INPUT message is sent to the window that is getting raw input. 
		/// </summary>
		INPUT = 0x00FF,
		/// <summary>
		/// This message filters for keyboard messages.
		/// </summary>
		KEYFIRST = 0x0100,
		/// <summary>
		/// The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed. 
		/// </summary>
		KEYDOWN = 0x0100,
		/// <summary>
		/// The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus. 
		/// </summary>
		KEYUP = 0x0101,
		/// <summary>
		/// The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed. 
		/// </summary>
		CHAR = 0x0102,
		/// <summary>
		/// The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key. 
		/// </summary>
		DEADCHAR = 0x0103,
		/// <summary>
		/// The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. 
		/// </summary>
		SYSKEYDOWN = 0x0104,
		/// <summary>
		/// The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter. 
		/// </summary>
		SYSKEYUP = 0x0105,
		/// <summary>
		/// The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down. 
		/// </summary>
		SYSCHAR = 0x0106,
		/// <summary>
		/// The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the ALT key. 
		/// </summary>
		SYSDEADCHAR = 0x0107,
		/// <summary>
		/// The WM_UNICHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_UNICHAR message contains the character code of the key that was pressed. 
		/// The WM_UNICHAR message is equivalent to WM_CHAR, but it uses Unicode Transformation Format (UTF)-32, whereas WM_CHAR uses UTF-16. It is designed to send or post Unicode characters to ANSI windows and it can can handle Unicode Supplementary Plane characters.
		/// </summary>
		UNICHAR = 0x0109,
		/// <summary>
		/// This message filters for keyboard messages.
		/// </summary>
		KEYLAST = 0x0109,
		/// <summary>
		/// Sent immediately before the IME generates the composition string as a result of a keystroke. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_STARTCOMPOSITION = 0x010D,
		/// <summary>
		/// Sent to an application when the IME ends composition. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_ENDCOMPOSITION = 0x010E,
		/// <summary>
		/// Sent to an application when the IME changes composition status as a result of a keystroke. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_COMPOSITION = 0x010F,
		IME_KEYLAST = 0x010F,
		/// <summary>
		/// The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box. 
		/// </summary>
		INITDIALOG = 0x0110,
		/// <summary>
		/// The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated. 
		/// </summary>
		COMMAND = 0x0111,
		/// <summary>
		/// A window receives this message when the user chooses a command from the Window menu, clicks the maximize button, minimize button, restore button, close button, or moves the form. You can stop the form from moving by filtering this out.
		/// </summary>
		SYSCOMMAND = 0x0112,
		/// <summary>
		/// The WM_TIMER message is posted to the installing thread's message queue when a timer expires. The message is posted by the GetMessage or PeekMessage function. 
		/// </summary>
		TIMER = 0x0113,
		/// <summary>
		/// The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control. 
		/// </summary>
		HSCROLL = 0x0114,
		/// <summary>
		/// The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control. 
		/// </summary>
		VSCROLL = 0x0115,
		/// <summary>
		/// The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed. 
		/// </summary>
		INITMENU = 0x0116,
		/// <summary>
		/// The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu. 
		/// </summary>
		INITMENUPOPUP = 0x0117,
		/// <summary>
		/// The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item. 
		/// </summary>
		MENUSELECT = 0x011F,
		/// <summary>
		/// The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu. 
		/// </summary>
		MENUCHAR = 0x0120,
		/// <summary>
		/// The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages. 
		/// </summary>
		ENTERIDLE = 0x0121,
		/// <summary>
		/// The WM_MENURBUTTONUP message is sent when the user releases the right mouse button while the cursor is on a menu item. 
		/// </summary>
		MENURBUTTONUP = 0x0122,
		/// <summary>
		/// The WM_MENUDRAG message is sent to the owner of a drag-and-drop menu when the user drags a menu item. 
		/// </summary>
		MENUDRAG = 0x0123,
		/// <summary>
		/// The WM_MENUGETOBJECT message is sent to the owner of a drag-and-drop menu when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item. 
		/// </summary>
		MENUGETOBJECT = 0x0124,
		/// <summary>
		/// The WM_UNINITMENUPOPUP message is sent when a drop-down menu or submenu has been destroyed. 
		/// </summary>
		UNINITMENUPOPUP = 0x0125,
		/// <summary>
		/// The WM_MENUCOMMAND message is sent when the user makes a selection from a menu. 
		/// </summary>
		MENUCOMMAND = 0x0126,
		/// <summary>
		/// An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed.
		/// </summary>
		CHANGEUISTATE = 0x0127,
		/// <summary>
		/// An application sends the WM_UPDATEUISTATE message to change the user interface (UI) state for the specified window and all its child windows.
		/// </summary>
		UPDATEUISTATE = 0x0128,
		/// <summary>
		/// An application sends the WM_QUERYUISTATE message to retrieve the user interface (UI) state for a window.
		/// </summary>
		QUERYUISTATE = 0x0129,
		/// <summary>
		/// The WM_CTLCOLORMSGBOX message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the given display device context handle. 
		/// </summary>
		CTLCOLORMSGBOX = 0x0132,
		/// <summary>
		/// An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control. 
		/// </summary>
		CTLCOLOREDIT = 0x0133,
		/// <summary>
		/// Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle. 
		/// </summary>
		CTLCOLORLISTBOX = 0x0134,
		/// <summary>
		/// The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message. 
		/// </summary>
		CTLCOLORBTN = 0x0135,
		/// <summary>
		/// The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle. 
		/// </summary>
		CTLCOLORDLG = 0x0136,
		/// <summary>
		/// The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control. 
		/// </summary>
		CTLCOLORSCROLLBAR = 0x0137,
		/// <summary>
		/// A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control. 
		/// </summary>
		CTLCOLORSTATIC = 0x0138,
		/// <summary>
		/// Use WM_MOUSEFIRST to specify the first mouse message. Use the PeekMessage() Function.
		/// </summary>
		MOUSEFIRST = 0x0200,
		/// <summary>
		/// The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		MOUSEMOVE = 0x0200,
		/// <summary>
		/// The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		LBUTTONDOWN = 0x0201,
		/// <summary>
		/// The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		LBUTTONUP = 0x0202,
		/// <summary>
		/// The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		LBUTTONDBLCLK = 0x0203,
		/// <summary>
		/// The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		RBUTTONDOWN = 0x0204,
		/// <summary>
		/// The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		RBUTTONUP = 0x0205,
		/// <summary>
		/// The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		RBUTTONDBLCLK = 0x0206,
		/// <summary>
		/// The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		MBUTTONDOWN = 0x0207,
		/// <summary>
		/// The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		MBUTTONUP = 0x0208,
		/// <summary>
		/// The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		MBUTTONDBLCLK = 0x0209,
		/// <summary>
		/// The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
		/// </summary>
		MOUSEWHEEL = 0x020A,
		/// <summary>
		/// The WM_XBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
		/// </summary>
		XBUTTONDOWN = 0x020B,
		/// <summary>
		/// The WM_XBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		XBUTTONUP = 0x020C,
		/// <summary>
		/// The WM_XBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
		/// </summary>
		XBUTTONDBLCLK = 0x020D,
		/// <summary>
		/// The WM_MOUSEHWHEEL message is sent to the focus window when the mouse's horizontal scroll wheel is tilted or rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
		/// </summary>
		MOUSEHWHEEL = 0x020E,
		/// <summary>
		/// Use WM_MOUSELAST to specify the last mouse message. Used with PeekMessage() Function.
		/// </summary>
		MOUSELAST = 0x020E,
		/// <summary>
		/// The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place.
		/// </summary>
		PARENTNOTIFY = 0x0210,
		/// <summary>
		/// The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered. 
		/// </summary>
		ENTERMENULOOP = 0x0211,
		/// <summary>
		/// The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited. 
		/// </summary>
		EXITMENULOOP = 0x0212,
		/// <summary>
		/// The WM_NEXTMENU message is sent to an application when the right or left arrow key is used to switch between the menu bar and the system menu. 
		/// </summary>
		NEXTMENU = 0x0213,
		/// <summary>
		/// The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position. 
		/// </summary>
		SIZING = 0x0214,
		/// <summary>
		/// The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.
		/// </summary>
		CAPTURECHANGED = 0x0215,
		/// <summary>
		/// The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position.
		/// </summary>
		MOVING = 0x0216,
		/// <summary>
		/// Notifies applications that a power-management event has occurred.
		/// </summary>
		POWERBROADCAST = 0x0218,
		/// <summary>
		/// Notifies an application of a change to the hardware configuration of a device or the computer.
		/// </summary>
		DEVICECHANGE = 0x0219,
		/// <summary>
		/// An application sends the WM_MDICREATE message to a multiple-document interface (MDI) client window to create an MDI child window. 
		/// </summary>
		MDICREATE = 0x0220,
		/// <summary>
		/// An application sends the WM_MDIDESTROY message to a multiple-document interface (MDI) client window to close an MDI child window. 
		/// </summary>
		MDIDESTROY = 0x0221,
		/// <summary>
		/// An application sends the WM_MDIACTIVATE message to a multiple-document interface (MDI) client window to instruct the client window to activate a different MDI child window. 
		/// </summary>
		MDIACTIVATE = 0x0222,
		/// <summary>
		/// An application sends the WM_MDIRESTORE message to a multiple-document interface (MDI) client window to restore an MDI child window from maximized or minimized size. 
		/// </summary>
		MDIRESTORE = 0x0223,
		/// <summary>
		/// An application sends the WM_MDINEXT message to a multiple-document interface (MDI) client window to activate the next or previous child window. 
		/// </summary>
		MDINEXT = 0x0224,
		/// <summary>
		/// An application sends the WM_MDIMAXIMIZE message to a multiple-document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window. 
		/// </summary>
		MDIMAXIMIZE = 0x0225,
		/// <summary>
		/// An application sends the WM_MDITILE message to a multiple-document interface (MDI) client window to arrange all of its MDI child windows in a tile format. 
		/// </summary>
		MDITILE = 0x0226,
		/// <summary>
		/// An application sends the WM_MDICASCADE message to a multiple-document interface (MDI) client window to arrange all its child windows in a cascade format. 
		/// </summary>
		MDICASCADE = 0x0227,
		/// <summary>
		/// An application sends the WM_MDIICONARRANGE message to a multiple-document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized. 
		/// </summary>
		MDIICONARRANGE = 0x0228,
		/// <summary>
		/// An application sends the WM_MDIGETACTIVE message to a multiple-document interface (MDI) client window to retrieve the handle to the active MDI child window. 
		/// </summary>
		MDIGETACTIVE = 0x0229,
		/// <summary>
		/// An application sends the WM_MDISETMENU message to a multiple-document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the window menu of the frame window, or both. 
		/// </summary>
		MDISETMENU = 0x0230,
		/// <summary>
		/// The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
		/// The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled.
		/// </summary>
		ENTERSIZEMOVE = 0x0231,
		/// <summary>
		/// The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
		/// </summary>
		EXITSIZEMOVE = 0x0232,
		/// <summary>
		/// Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files.
		/// </summary>
		DROPFILES = 0x0233,
		/// <summary>
		/// An application sends the WM_MDIREFRESHMENU message to a multiple-document interface (MDI) client window to refresh the window menu of the MDI frame window. 
		/// </summary>
		MDIREFRESHMENU = 0x0234,
		/// <summary>
		/// Sent to an application when a window is activated. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_SETCONTEXT = 0x0281,
		/// <summary>
		/// Sent to an application to notify it of changes to the IME window. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_NOTIFY = 0x0282,
		/// <summary>
		/// Sent by an application to direct the IME window to carry out the requested command. The application uses this message to control the IME window that it has created. To send this message, the application calls the SendMessage function with the following parameters.
		/// </summary>
		IME_CONTROL = 0x0283,
		/// <summary>
		/// Sent to an application when the IME window finds no space to extend the area for the composition window. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_COMPOSITIONFULL = 0x0284,
		/// <summary>
		/// Sent to an application when the operating system is about to change the current IME. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_SELECT = 0x0285,
		/// <summary>
		/// Sent to an application when the IME gets a character of the conversion result. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_CHAR = 0x0286,
		/// <summary>
		/// Sent to an application to provide commands and request information. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_REQUEST = 0x0288,
		/// <summary>
		/// Sent to an application by the IME to notify the application of a key press and to keep message order. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_KEYDOWN = 0x0290,
		/// <summary>
		/// Sent to an application by the IME to notify the application of a key release and to keep message order. A window receives this message through its WindowProc function. 
		/// </summary>
		IME_KEYUP = 0x0291,
		/// <summary>
		/// The WM_MOUSEHOVER message is posted to a window when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent.
		/// </summary>
		MOUSEHOVER = 0x02A1,
		/// <summary>
		/// The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
		/// </summary>
		MOUSELEAVE = 0x02A3,
		/// <summary>
		/// The WM_NCMOUSEHOVER message is posted to a window when the cursor hovers over the nonclient area of the window for the period of time specified in a prior call to TrackMouseEvent.
		/// </summary>
		NCMOUSEHOVER = 0x02A0,
		/// <summary>
		/// The WM_NCMOUSELEAVE message is posted to a window when the cursor leaves the nonclient area of the window specified in a prior call to TrackMouseEvent.
		/// </summary>
		NCMOUSELEAVE = 0x02A2,
		/// <summary>
		/// The WM_WTSSESSION_CHANGE message notifies applications of changes in session state.
		/// </summary>
		WTSSESSION_CHANGE = 0x02B1,
		TABLET_FIRST = 0x02c0,
		TABLET_LAST = 0x02df,
		/// <summary>
		/// An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format. 
		/// </summary>
		CUT = 0x0300,
		/// <summary>
		/// An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format. 
		/// </summary>
		COPY = 0x0301,
		/// <summary>
		/// An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format. 
		/// </summary>
		PASTE = 0x0302,
		/// <summary>
		/// An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control. 
		/// </summary>
		CLEAR = 0x0303,
		/// <summary>
		/// An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted.
		/// </summary>
		UNDO = 0x0304,
		/// <summary>
		/// The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function. 
		/// </summary>
		RENDERFORMAT = 0x0305,
		/// <summary>
		/// The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function. 
		/// </summary>
		RENDERALLFORMATS = 0x0306,
		/// <summary>
		/// The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard. 
		/// </summary>
		DESTROYCLIPBOARD = 0x0307,
		/// <summary>
		/// The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard. 
		/// </summary>
		DRAWCLIPBOARD = 0x0308,
		/// <summary>
		/// The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting. 
		/// </summary>
		PAINTCLIPBOARD = 0x0309,
		/// <summary>
		/// The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
		/// </summary>
		VSCROLLCLIPBOARD = 0x030A,
		/// <summary>
		/// The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size. 
		/// </summary>
		SIZECLIPBOARD = 0x030B,
		/// <summary>
		/// The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.
		/// </summary>
		ASKCBFORMATNAME = 0x030C,
		/// <summary>
		/// The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain. 
		/// </summary>
		CHANGECBCHAIN = 0x030D,
		/// <summary>
		/// The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
		/// </summary>
		HSCROLLCLIPBOARD = 0x030E,
		/// <summary>
		/// This message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus. 
		/// </summary>
		QUERYNEWPALETTE = 0x030F,
		/// <summary>
		/// The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette. 
		/// </summary>
		PALETTEISCHANGING = 0x0310,
		/// <summary>
		/// This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette. 
		/// This message enables windows that do not have the keyboard focus to realize their logical palettes and update their client areas.
		/// </summary>
		PALETTECHANGED = 0x0311,
		/// <summary>
		/// The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key. 
		/// </summary>
		HOTKEY = 0x0312,
		/// <summary>
		/// The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.
		/// </summary>
		PRINT = 0x0317,
		/// <summary>
		/// The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.
		/// </summary>
		PRINTCLIENT = 0x0318,
		/// <summary>
		/// The WM_APPCOMMAND message notifies a window that the user generated an application command event, for example, by clicking an application command button using the mouse or typing an application command key on the keyboard.
		/// </summary>
		APPCOMMAND = 0x0319,
		/// <summary>
		/// The WM_THEMECHANGED message is broadcast to every window following a theme change event. Examples of theme change events are the activation of a theme, the deactivation of a theme, or a transition from one theme to another.
		/// </summary>
		THEMECHANGED = 0x031A,
		/// <summary>
		/// Sent when the contents of the clipboard have changed.
		/// </summary>
		CLIPBOARDUPDATE = 0x031D,
		/// <summary>
		/// The system will send a window the WM_DWMCOMPOSITIONCHANGED message to indicate that the availability of desktop composition has changed.
		/// </summary>
		DWMCOMPOSITIONCHANGED = 0x031E,
		/// <summary>
		/// WM_DWMNCRENDERINGCHANGED is called when the non-client area rendering status of a window has changed. Only windows that have set the flag DWM_BLURBEHIND.fTransitionOnMaximized to true will get this message. 
		/// </summary>
		DWMNCRENDERINGCHANGED = 0x031F,
		/// <summary>
		/// Sent to all top-level windows when the colorization color has changed. 
		/// </summary>
		DWMCOLORIZATIONCOLORCHANGED = 0x0320,
		/// <summary>
		/// WM_DWMWINDOWMAXIMIZEDCHANGE will let you know when a DWM composed window is maximized. You also have to register for this message as well. You'd have other windowd go opaque when this message is sent.
		/// </summary>
		DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
		/// <summary>
		/// Sent to request extended title bar information. A window receives this message through its WindowProc function.
		/// </summary>
		GETTITLEBARINFOEX = 0x033F,
		HANDHELDFIRST = 0x0358,
		HANDHELDLAST = 0x035F,
		AFXFIRST = 0x0360,
		AFXLAST = 0x037F,
		PENWINFIRST = 0x0380,
		PENWINLAST = 0x038F,
		/// <summary>
		/// The WM_APP constant is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value. 
		/// </summary>
		APP = 0x8000,
		/// <summary>
		/// The WM_USER constant is used by applications to help define private messages for use by private window classes, usually of the form WM_USER+X, where X is an integer value. 
		/// </summary>
		USER = 0x0400,

		/// <summary>
		/// An application sends the WM_CPL_LAUNCH message to Windows Control Panel to request that a Control Panel application be started. 
		/// </summary>
		CPL_LAUNCH = USER + 0x1000,
		/// <summary>
		/// The WM_CPL_LAUNCHED message is sent when a Control Panel application, started by the WM_CPL_LAUNCH message, has closed. The WM_CPL_LAUNCHED message is sent to the window identified by the wParam parameter of the WM_CPL_LAUNCH message that started the application. 
		/// </summary>
		CPL_LAUNCHED = USER + 0x1001,
		/// <summary>
		/// WM_SYSTIMER is a well-known yet still undocumented message. Windows uses WM_SYSTIMER for internal actions like scrolling.
		/// </summary>
		SYSTIMER = 0x118
	}

	private enum HookType : int
	{
		WH_JOURNALRECORD = 0,
		WH_JOURNALPLAYBACK = 1,
		WH_KEYBOARD = 2,
		WH_GETMESSAGE = 3,
		WH_CALLWNDPROC = 4,
		WH_CBT = 5,
		WH_SYSMSGFILTER = 6,
		WH_MOUSE = 7,
		WH_HARDWARE = 8,
		WH_DEBUG = 9,
		WH_SHELL = 10,
		WH_FOREGROUNDIDLE = 11,
		WH_CALLWNDPROCRET = 12,
		WH_KEYBOARD_LL = 13,
		WH_MOUSE_LL = 14
	}

	[StructLayout(LayoutKind.Sequential)]
	private struct POINT
	{
		public int x;
		public int y;
	}

	[StructLayout(LayoutKind.Sequential)]
	private struct MSLLHOOKSTRUCT
	{
		public POINT pt;
		public uint mouseData;
		public uint flags;
		public uint time;
		public UIntPtr dwExtraInfo;
	}
}

Open in new window

0
 
LVL 14

Expert Comment

by:systan
ID: 35197195
I have a better, simple, shorter, tested windows form solution for capturing mouse location, events of mouse up or down and number of clicks if is was doubled, singled or none.  Please object it if interested for the whole better simple shorter code in 1 class form.
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35197950
Good to know on that delegate garbage collection, thanks for the update.

I for one am curious to see systan's solution, but I suppose that's up to DaTribe if he wants to re-open the question and evaluate another possibility.
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35201322
I would love to reopen the question. How do I do that?

DaTribe
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 18

Author Comment

by:Richard Lee
ID: 35205520
Lets see systan's solution
0
 
LVL 14

Expert Comment

by:systan
ID: 35206227
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35206500
Lol...that's almost word for word the same class, the one above just looks long because I copy & pasted all the WM_ constants from www.pinvoke.com because I didn't feel like looking up the applicable mouse messages. ;)
0
 
LVL 14

Expert Comment

by:systan
ID: 35206847
DaTribe says;
>>If I were asking for an entire application then I could understand however I stated clearly that I needed a code example for a short feature.
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35206969
Thanks for the example systan. I do think its pretty much the same as what tgerbert provided. You have also provided code for the arrow keys, but for my purposes this is not necessary however it would have been a simply added to the previous code.

I am curious about your use of
Assembly.GetExecutingAssembly().GetModules()[0] as opposed to the previous example's use of GetModuleHandle(IntPtr.Zero)

DaTribe
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35206983
Sorry, I was laughing to myself how ridiciulous it was to copy/paste every single windows message, not your code example. ;)
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35207041
I think from the thread of this question tgerbert we know your diplomacy skills are much better than mine - or maybe I was caught on a bad day :), who knows! I am sure there was no offence intended where systan is concerned.

DaTribe
0
 
LVL 14

Expert Comment

by:systan
ID: 35207539
>>You have also provided code for the arrow keys
arrow_keys?,no_i_didn't._you_did_not_say_anything_about_keyboards.
the simpleness of the code was?, the mouse_Delta was used to get the mouse down and up.
Anyway, it's a fun comment at this post.

thanks for the time
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35207688
Sorry systan. I mean't to say mouse clicks.
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35207713
Just to be clear. I mean't you provided code for the mouse clicks but for my purposes I won't be using that. Thanks for the input. What are your thoughts on my earlier comment? ID: 35206969
0
 
LVL 14

Assisted Solution

by:systan
systan earned 125 total points
ID: 35208608
Oh,_about_this_lines?
hMouseHook = SetWindowsHookEx(WH_MOUSE_LL,
                MouseHookProcedure,
                Marshal.GetHINSTANCE(
                Assembly.GetExecutingAssembly().GetModules()[0]),
                0);

It's_actually_a_handle_containing_the_hook_pointed,  it_is_set,  if dW_thread_id is not specified.

GetModuleHandle(IntPtr.Zero), because_dW_thread_id_was_set.


hMod [in]

    Type: HINSTANCE

    A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
dwThreadId [in]

    Type: DWORD

    The identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.


http://msdn.microsoft.com/en-us/library/ms644990%28v=vs.85%29.aspx
0
 
LVL 14

Expert Comment

by:systan
ID: 35208725
if_you_are_using_the_mouse_pointer_to_get_some_information_about_the_window_application_or_from_desktop_handle?, use_it_or_declare_it.

if_not_?
Don't_declare_it.
hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProcedure, 0,  0);


I_hope_you_got_MY_information_very_load.
Good_Luck.
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35213648
It's clear now :).
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35213770
Just to be clear, in the call to SetWindowsHookEx, to set a global hook (e.g. catch mouse messages system-wide, not just your own application), dwThreadId must be NULL, and hMod must be the handle to the current module (as returned by GetModuleHandle(IntPtr.Zero) or Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0])).

From managed .Net code you can only install a low-level mouse or low-level keyboard hook globally; other types of hooks can only be installed for your own application.

To install a hook for just your application (which can be any type of hook), dwThreadId must be the ID of the thread whose messages you want to intercept, and hMod must be NULL.
0
 
LVL 14

Expert Comment

by:systan
ID: 35214695
yes;
This_is_the_proper_explanation_from_Microsoft;
The hMod parameter must be set to NULL _IF_ the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.

it's_all_very_clear;)
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35214718
Honestly, I thought the MSDN docs were a little confusing - which is why my first code snippet was passing null for hMod - fortunately someone else spotted the error & fixed it.
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 35236022
The normal mouse events should continue to work, so long as your LowLevelMouseProc (http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx) returns the value it obtained from CallNextHookEx; if your LowLevelMouseProc callback returns some other value that's positive, the WM_MOUSExxx message won't be passed to the next hook in the chain, or to the target window.
0
 
LVL 18

Author Comment

by:Richard Lee
ID: 35242031
I will have a look at what is happening tgerbert. Appreciate the feedback. I was working on a fluent mail api for the last few days. I will get back to the app. that needs the mouse input shortly.

http://www.avantprime.com/products/view-product/8/fluent-mail

DaTribe
0
 
LVL 14

Expert Comment

by:systan
ID: 35270921
0
 
LVL 18

Author Closing Comment

by:Richard Lee
ID: 35304322
Thanks you guys. Excellent job. Will have to work my way through the msdn docs since with every introduction of new features there are introduction of problems to solve. Systan I will indeed have to handle the other mouse events such as mouse up and move down since once the hook is activated the standard mouse events don't work :).
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now