WindowMessages Enumeration

The system sends or posts a system-defined message when it communicates with an application.

It uses these messages to control the operations of applications and to provide input and other information for applications to process.

An application can also send or post system-defined messages.

Applications generally use these messages to control the operation of control windows created by using preregistered window classes.

Definition

Namespace: DevCase.Win32.Enums
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public enum WindowMessages

Remarks

Members

Null 0 The Null message performs no operation.

An application sends the Null message if it wants to send a message that the recipient window will ignore.

WM_Create 1 The 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.

WM_Destroy 2 The 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.

WM_Move 3 Sent after a window has been moved.

wParam This parameter is not used.

lParam The x and y coordinates of the upper-left corner of the client area of the window.

The low-order word contains the x-coordinate while the high-order word contains the y coordinate.

WM_Size 5 Sent to a window after its size has changed.

wParam The type of resizing requested.

lParam The low-order word of lParam specifies the new width of the client area.

The high-order word of lParam specifies the new height of the client area.

WM_Activate 6 The message is sent when a window is being activated or deactivated.

This message is sent first to the window procedure of the top-level window being deactivated; it is then sent to the window procedure of the top-level window being activated.

wParam The low-order word specifies whether the window is being activated or deactivated.

This parameter can be one of the following values:

WA_ActiveWA_ClickActiveWA_Inactive

The high-order word specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.

lParam A handle to the window being activated or deactivated, depending on the value of the wParam parameter.

If the low-order word of wParam is WA_Inactive, lParam is the handle to the window being activated.

If the low-order word of wParam is WA_Active or WA_ClickActive, lParam is the handle to the window being deactivated. This handle can be Zero.

Return value If an application processes this message, it should return zero.

WM_SetFocus 7 When the control got the focus.
WM_KillFocus 8 The message is sent to a window immediately before it loses the keyboard focus.
WM_Enable 10 The 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.

WM_SetRedraw 11 An application sends this message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.

wParam The redraw state.

If this parameter is , the content can be redrawn after a change.

If this parameter is , the content cannot be redrawn after a change.

lParam This parameter is not used.

WM_SetText 12 Sets the text of a window.

wParam This parameter is not used

lParam A pointer to a null-terminated string that is the window text.

WM_GetText 13 Copies the text that corresponds to a window into a buffer provided by the caller.

wParam The maximum number of characters to be copied, including the terminating null character.

ANSI applications may have the string in the buffer reduced in size (to a minimum of half that of the wParam value) due to conversion from ANSI to Unicode.

lParam A pointer to the buffer that is to receive the text.

WM_GetTextLength 14 Determines the length, in characters, of the text associated with a window.

wParam This parameter is not used and must be zero

lParam This parameter is not used and must be zero

WM_Paint 15 Occurs when the control needs repainting.
WM_Close 16 Sent as a signal that a window or an application should terminate.

wParam This parameter is not used.

lParam This parameter is not used.

WM_QueryEndSession 17 The 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.

WM_Quit 18 Once received it ends the application's Message Loop signaling the application to end.

It can be sent by pressing Alt+F4 Clicking the X in the upper right-hand of the program or going to File->Exit.

WM_QueryOpen 19 Sent to an icon when the user requests that the window be restored to its previous size and position.

wParam Not used.

lParam Not used.

WM_EraseBkgnd 20 The 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.

WM_SysColorChange 21 This message is sent to all top-level windows when a change is made to a system color setting.
WM_EndSession 22 The message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message.

This message informs the application whether the session is ending.

WM_ShowWindow 24 Sent to a window when the window is about to be hidden or shown.

wParam Indicates whether a window is being shown.

If wParam is , the window is being shown. If wParam is , the window is being hidden.

lParam The status of the window being shown.

If lParam is zero, the message was sent because of a call to the ShowWindow(IntPtr, NativeWindowState) function.

WM_SettingChange 26 A message that is sent to all top-level windows when the SystemParametersInfo function changes a system-wide setting or when policy settings have changed.

Applications should send WM_SettingChange to all top-level windows when they make changes to system parameters

This message cannot be sent directly to a single window.

To send the WM_SettingChange message to all top-level windows, use the SendMessageTimeout(IntPtr, EditControlMessages, IntPtr, IntPtr, SendMessageTimeoutFlags, Int32, IntPtr) function with the hwnd parameter set to HWND_Broadcast.

wParam See Remakrs.

lParam See Remakrs.

WM_DevmodeChange 27 The message is sent to all top-level windows whenever the user changes device-mode settings.
WM_ActivateApp 28 The 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.

WM_FontChange 29 An application sends the message to all top-level windows in the system after changing the pool of font resources.
WM_TimeChange 30 A message that is sent whenever there is a change in the system time.
WM_CancelMode 31 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.

wParam Not used.

lParam Not used.

WM_MouseActivate 33 The 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.

WM_GetMinMaxInfo 36 The 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.

WM_SpoolerStatus 42 The message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue.
WM_SetFont 48 Sets the font that a control is to use when drawing text.

wParam A handle to the font (HFONT).

If this parameter is , the control uses the default system font to draw text.

lParam The low-order word of lParam specifies whether the control should be redrawn immediately upon setting the font.

If this parameter is TRUE, the control redraws itself.

WM_SetHotkey 50 An application sends this message to a window to associate a hot key with the window.

When the user presses the hot key the system activates the window.

WM_GetHotkey 51 An application sends this message to determine the hot key associated with a window.
WM_WindowPosChanging 70 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(IntPtr, IntPtr, Int32, Int32, Int32, Int32, SetWindowPosFlags) function or another window-management function.

wParam This parameter is not used.

lParam A pointer to a WINDOWPOS structure that contains information about the window's new size and position.

WM_WindowPosChanged 71 The 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.
WM_Help 83 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 WmHELP 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.

WM_UserChanged 84 The 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.

WM_Contextmenu 123 The message notifies a window that the user clicked the right mouse button (right-clicked) in the window.
WM_StyleChanging 124 The message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.
WM_StyleChanged 125 The message is sent to a window after the SetWindowLong function has changed one or more of the window's styles.
WM_DisplayChange 126 The message is sent to all windows when the display resolution has changed.
WM_NcCreate 129 The message is sent prior to the WM_Create message when a window is first created.
WM_NcDestroy 130 The message informs a window that its nonclient area is being destroyed.

The DestroyWindow(IntPtr) 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.

WM_NcCalcSize 131 The 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.

WM_NchitTest 132 Sent to a window in order to determine what part of the window corresponds to a particular screen coordinate.

This can happen, for example, when the cursor moves, when a mouse button is pressed or released, or in response to a call to a function such as WindowFromPoint.

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.

wParam This parameter is not used.

lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.

WM_NcPaint 133 The message is sent to a window when its frame must be painted.
WM_NcActivate 134 Non Client Area Activated Caption(Title) of the Form.
WM_NcMouseMove 160 This 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.

wParam The hit-test value returned by the DefWindowProc function as a result of processing the WM_NchitTest message.

For a list of hit-test values, see WM_NchitTest.

lParam A POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_NcLButtonDown 161 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.

wParam The hit-test value returned by the DefWindowProc function as a result of processing the WM_NchitTest message.

lParam A POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_NcLButtonUp 162 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.

wParam The hit-test value returned by the DefWindowProc function as a result of processing the WM_NchitTest message.

lParam A POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_NcLButtonDblClk 163 The 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.

WM_NcRButtonDown 164 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.

wParam The hit-test value returned by the DefWindowProc function as a result of processing the WM_NchitTest message.

lParam A POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_NcRButtonUp 165 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.

wParam The hit-test value returned by the DefWindowProc function as a result of processing the WM_NchitTest message.

lParam A POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_NcRButtonDblClk 166 The 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.

WM_NcMButtonDown 167 The 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.

WM_NcMButtonUp 168 The 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.

WM_NcMButtonDblClk 169 The 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.

WM_NcXButtonDown 171 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.

wParam The low-order word specifies the hit-test value returned by the DefWindowProc function from processing the WM_NchitTest message.

For a list of hit-test values, WM_NchitTest.

The high-order word indicates which button was pressed.

lParam A pointer to a POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_NcXButtonUp 172 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.

wParam The low-order word specifies the hit-test value returned by the DefWindowProc function from processing the WM_NchitTest message.

For a list of hit-test values, WM_NchitTest.

The high-order word indicates which button was released.

lParam A pointer to a POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_NcXButtonDblClk 173 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.

wParam The low-order word specifies the hit-test value returned by the DefWindowProc function from processing the WM_NchitTest message.

For a list of hit-test values, WM_NchitTest.

The high-order word indicates which button was double-clicked.

lParam A pointer to a POINTS structure that contains the x- and y-coordinates of the cursor.

The coordinates are relative to the upper-left corner of the screen.

WM_InputDeviceChange 254 Sent to the window that registered to receive raw input.

A window receives this message through its WndProc function.

wParam This parameter can be one of the following values.

GIDC_ARRIVAL (1): A new device has been added to the system.

GIDC_REMOVAL (0): A new device has been removed from the system.

lParam A handle to the RawInput structure that contains the raw input from the device.

Call GetRawInputDeviceInfo(IntPtr, GetRawInputDeviceInfoCommand, IntPtr, UInt32) to get more information regarding the device.

WM_Input 255 Sent to the window that is getting raw input.

A window receives this message through its WndProc function.

wParam The input code.

lParam A handle to the RawInput structure that contains the raw input from the device.

Call GetRawInputDeviceInfo(IntPtr, GetRawInputDeviceInfoCommand, IntPtr, UInt32) to get more information regarding the device.

WM_KeyDown 256 The 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.

wParam The virtual-key code of the nonsystem key.

lParam The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following:

Bit 0-15: The repeat count for the current message.

The value is the number of times the keystroke is autorepeated as a result of the user holding down the key.

If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative

Bit 16-23: The scan code. The value depends on the OEM.

Bit 24: Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard.

The value is 1 if it is an extended key; otherwise, it is 0.

Bit 25-28: Reserved; do not use

Bit 29: The context code.

The value is always 0 for a WM_KeyDown message.

Bit 30: The previous key state.

The value is 1 if the key is down before the message is sent, or it is zero if the key is up.

Bit 31: The transition state.

The value is always 0 for a WM_KeyDown message.

WM_KeyFirst 256 This message filters for keyboard messages.

Use the WM_KeyFirst and WM_KeyLast messages to filter for keyboard messages when using the GetMessage(NativeMessage, IntPtr, UInt32, UInt32) and PeekMessage(NativeMessage, IntPtr, UInt32, UInt32, PeekMessageFlags) functions.

wParam Not used.

lParam Not used.

WM_KeyUp 257 The 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.

wParam The virtual-key code of the nonsystem key.

lParam The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following:

Bit 0-15: The repeat count for the current message.

The value is the number of times the keystroke is autorepeated as a result of the user holding down the key.

The repeat count is always 1 for a WM_KeyUp message.

If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative

Bit 16-23: The scan code. The value depends on the OEM.

Bit 24: Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard.

The value is 1 if it is an extended key; otherwise, it is 0.

The value is 1 if it is an extended key; otherwise, it is 0.

Bit 25-28: Reserved; do not use

Bit 29: The context code.

The value is always 0 for a WM_KeyUp message.

Bit 30: The previous key state.

The value is always 1 for a WM_KeyUp message.

Bit 31: The transition state.

The value is always 1 for a WM_KeyUp message.

WM_SysKeyDown 260 The 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.

wParam The virtual-key code of the key being pressed.

lParam The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following:

Bit 0-15: The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key.

If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

Bit 16-23: The scan code. The value depends on the OEM.

Bit 24: Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard.

The value is 1 if it is an extended key; otherwise, it is 0.

Bit 25-28: Reserved; do not use

Bit 29: The context code.

The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SysKeyDown message is posted to the active window because no window has the keyboard focus.

Bit 30: The previous key state.

The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.

Bit 31: The transition state.

The value is always 0 for a WM_SysKeyDown message.

WM_SysKeyUp 261 The 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.

wParam The virtual-key code of the key being released.

lParam The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following:

Bit 0-15: The repeat count for the current message.

The value is the number of times the keystroke is autorepeated as a result of the user holding down the key.

The repeat count is always one for a WM_SysKeyUp message.

Bit 16-23: The scan code. The value depends on the OEM.

Bit 24: Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard.

The value is 1 if it is an extended key; otherwise, it is zero.

Bit 25-28: Reserved; do not use

Bit 29: The context code.

The value is 1 if the ALT key is down while the key is released; it is zero if the WM_SysKeyDown message is posted to the active window because no window has the keyboard focus.

Bit 30: The previous key state.

The value is always 1 for a WM_SysKeyUp message.

Bit 31: The transition state.

The value is always 1 for a WM_SysKeyUp message.

WM_KeyLast 265 This message filters for keyboard messages.

Use the WM_KeyFirst and WM_KeyLast messages to filter for keyboard messages when using the GetMessage(NativeMessage, IntPtr, UInt32, UInt32) and PeekMessage(NativeMessage, IntPtr, UInt32, UInt32, PeekMessageFlags) functions.

wParam Not used.

lParam Not used.

WM_InitDialog 272 The 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.

WM_Command 273 Message 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.

wParam For a description of this parameter, see Remarks.

lParam For a description of this parameter, see Remarks.

WM_SysCommand 274 A window receives this message when the user chooses a command from the Window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.

wParam The type of system command requested

lParam The low-order word specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse.

Otherwise, this parameter is not used.

The high-order word specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse.

This parameter is –1 if the command is chosen using a system accelerator, or zero if using a mnemonic.

WM_Timer 275 Posted to the installing thread's message queue when a timer expires.

The message is posted by the GetMessage(NativeMessage, IntPtr, UInt32, UInt32) or PeekMessage(NativeMessage, IntPtr, UInt32, UInt32, PeekMessageFlags) function.

wParam The timer identifier.

lParam A pointer to an application-defined callback function that was passed to the SetTimer function when the timer was installed.

WM_HScroll 276 This 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.

WM_VScroll 277 The 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.

WM_InitMenu 278 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.

wParam A handle to the menu to be initialized.

lParam This parameter is not used.

WM_InitMenuPopup 279 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.

wParam A handle to the drop-down menu or submenu.

lParam The low-order word specifies the zero-based relative position of the menu item that opens the drop-down menu or submenu.

The high-order word indicates whether the drop-down menu is the window menu.

If the menu is the window menu, this parameter is ; otherwise, it is .

WM_MenuSelect 287 The message is sent to a menu's owner window when the user selects a menu item.
WM_EnterIdle 289 The 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.

WM_MenuRButtonUp 290 The message is sent when the user releases the right mouse button while the cursor is on a menu item.
WM_MenuCommand 294 The message is sent when the user makes a selection from a menu.
WM_ChangeUiState 295 An application sends the message to indicate that the user interface (UI) state should be changed.
WM_CtlColorEdit 307 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.

wParam A handle to the device context for the edit control window.

lParam A handle to the edit control.

WM_MouseMove 512 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.

wParam Indicates whether various virtual keys are down.

lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

WM_MouseFirst 512 This message filters for mouse messages.

Use the WM_MouseFirst and WM_MouseLast messages to filter for mouse messages when using the GetMessage(NativeMessage, IntPtr, UInt32, UInt32) and PeekMessage(NativeMessage, IntPtr, UInt32, UInt32, PeekMessageFlags) functions.

wParam Not used.

lParam Not used.

WM_LButtonDown 513 The 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.

WM_LButtonUp 514 The 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.

WM_LButtonDblClk 515 The 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.

WM_RButtonDown 516 The 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.

WM_RButtonUp 517 The 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.

WM_RButtonDblClk 518 The 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.

WM_MButtonDown 519 The 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.

WM_MButtonUp 520 The 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.

WM_MButtonDblClk 521 The WmMBUTTONDBLCLK 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.

WM_MouseWheel 522 The 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.

wParam The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.

The low-order word indicates whether various virtual keys are down.

lParam The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.

The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen

WM_MouseLast 522 This message filters for mouse messages.

Use the WM_MouseFirst and WM_MouseLast messages to filter for mouse messages when using the GetMessage(NativeMessage, IntPtr, UInt32, UInt32) and PeekMessage(NativeMessage, IntPtr, UInt32, UInt32, PeekMessageFlags) functions.

wParam Not used.

lParam Not used.

WM_XButtonDown 523 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.

wParam The low-order word indicates whether various virtual keys are down.

The high-order word indicates which button was clicked.

lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

WM_XButtonUp 524 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.

wParam The low-order word indicates whether various virtual keys are down.

The high-order word indicates which button was double-clicked.

lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

WM_XButtonDblClk 525 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.

wParam The low-order word indicates whether various virtual keys are down.

The high-order word indicates which button was double-clicked.

lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

WM_MouseHWheel 526 The 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.

wParam The high-order word indicates the distance the wheel is rotated, expressed in multiples or factors of WHEEL_DELTA, which is set to 120. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left.

The low-order word indicates whether various virtual keys are down.

lParam The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.

The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen

WM_Sizing 532 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.

wParam The edge of the window that is being sized.

lParam A pointer to a NativeRectangle structure with the screen coordinates of the drag rectangle.

To change the size or position of the drag rectangle, an application must change the members of this structure.

WM_Moving 534 The 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.

WM_PowerBroadcast 536 Notifies applications that a power-management event has occurred.
WM_DeviceChange 537 Notifies an application of a change to the hardware configuration of a device or the computer.
WM_MdiCreate 544 An application sends this message to a multiple-document interface (MDI) client window to create an MDI child window.
WM_MdiDestroy 545 An application sends this message to a multiple-document interface (MDI) client window to close an MDI child window.
WM_MdiActivate 546 An application sends this message to a multiple-document interface (MDI) client window to instruct the client window to activate a different MDI child window.
WM_EnterSizeMove 561 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.

wParam This parameter is not used.

lParam This parameter is not used.

WM_ExitSizeMove 562 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.

wParam This parameter is not used.

lParam This parameter is not used.

WM_MouseHover 673 The 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.
WM_NcMouseLeave 674 The message is posted to a window when the cursor leaves the nonclient area of the window specified in a prior call to TrackMouseEvent.
WM_MouseLeave 675 The message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
WM_Cut 768 An application sends this 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.

wParam This parameter is not used and must be zero.

lParam This parameter is not used and must be zero.

WM_Copy 769 An application sends this message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.

wParam This parameter is not used and must be zero.

lParam This parameter is not used and must be zero.

WM_Paste 770 An application sends this 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.

wParam This parameter is not used and must be zero.

lParam This parameter is not used and must be zero.

WM_Clear 771 An application sends the message to an edit control or combo box to delete (clear) the current selection if any from the edit control.

wParam This parameter is not used and must be zero.

lParam This parameter is not used and must be zero.

WM_Undo 772 An application sends this 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.

WM_DestroyClipboard 775 The message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard.
WM_Hotkey 786 Posted when the user presses a hot key registered by the RegisterHotKey(IntPtr, Int32, UInt32, UInt32) function.

The message is placed at the top of the message queue associated with the thread that registered the hot key.

wParam The identifier of the hot key that generated the message. If the message was generated by a system-defined hot key.

lParam The low-order word specifies the keys that were to be pressed in combination with the key specified by the high-order word to generate the WM_Hotkey message.

WM_Print 791 The message is sent to a window to request that it draw itself in the specified device context most commonly in a printer device context.
WM_PrintClient 792 The 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.
WM_AppCommand 793 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.

wParam A handle to the window where the user clicked the button or pressed the key. This can be a child window of the window receiving the message.

lParam See Remarks.

WM_DwmCompositionChanged 798 Informs all top-level windows that Desktop Window Manager (DWM) composition has been enabled or disabled.

Note: As of Windows 8/8.1/10, DWM composition is always enabled, so this message is not sent regardless of video mode changes.

wParam Not used.

lParam Not used.

Wm_DwmNcRenderingChanged 799 Sent when the non-client area rendering policy has changed.

wParam Specifies whether DWM rendering is enabled for the non-client area of the window. if enabled; otherwise, .

lParam Not used.

WM_DwmColorizationColorChanged 800 Informs all top-level windows that the colorization color has changed.

wParam Specifies the new colorization color.

The color format is 0xAARRGGBB.

lParam Specifies whether the new color is blended with opacity.

WM_DwmWindowMaximizedChanged 801 Sent when a Desktop Window Manager (DWM) composed window is maximized.

wParam Set to true to specify that the window has been maximized.

lParam Not used.

WM_DwmSendIconicThumbnail 803 Instructs a window to provide a static bitmap to use as a thumbnail representation of that window.

Desktop Window Manager (DWM) sends this message to a window if all of the following situations are true:

DWM is displaying an iconic representation of the window.

The HasIconicBitmap and ForceIconicRepresentation attributes are set on the window.

The window did not set a cached bitmap.

There is room in the cache for another bitmap.

wParam Not used.

lParam The HIWORD of this value is the maximum possible width of the thumbnail.

The LOWORD is the maximum possible height.

If a thumbnail has a dimension that exceeds one or both of these values, the DWM does not accept the thumbnail.

WM_DwmSendIconicLivePreviewBitmap 806 Instructs a window to provide a static bitmap to use as a live preview (also known as a Peek preview) of that window.

Desktop Window Manager (DWM) sends this message to a window if all of the following situations are true:

Live preview has been invoked on the window

The HasIconicBitmap and ForceIconicRepresentation attributes are set on the window.

An iconic representation is the only one that exists for this window.

wParam Not used.

lParam Not used.

MM_MciNotify 953 Notifies an application that an MCI device has completed an operation. MCI devices send this message only when the MCI_NOTIFY flag is used.

wParam Reason for the notification.

lParam Identifier of the device initiating the callback function.

WM_User 1,024 Used to define private messages for use by private window classes, usually of the form 'WM_User + x', where 'x' is an integer value.
WM_App 32,768 Used to define private messages, usually of the form 'WM_App + x', where 'x' is an integer value.
HWND_Broadcast 65,535 The message is sent to all top-level windows in the system, including disabled or invisible unowned windows.

The function does not return until each window has timed out. Therefore, the total wait time can be up to the value of uTimeout multiplied by the number of top-level windows.

See Also