Window-management messages are sent by Windows to an application when the state of a window changes. The following list briefly describes each window-management message:
Message | Description | |
WM_ACTIVATE | Sent when a window becomes active or inactive. | |
WM_ACTIVATEAPP | Sent when the window being activated belongs to a different application than the window that was previously active. | |
WM_CANCELMODE | Cancels any mode the system is in, such as one that tracks the mouse in a scroll bar or moves a window. Windows sends the WM_CANCELMODE message when an application displays a message box. |
|
WM_CHILDACTIVATE | Notifies a child window's parent window when the SetWindowPos function moves a child window. | |
WM_CLOSE | Sent whenever the window is closed. | |
WM_CREATE | Sent when the CreateWindow function is called. | |
WM_CTLCOLOR | Sent to the parent window of a predefined control or message box when the control or message box is about to be drawn. | |
WM_DESTROY | Sent when the DestroyWindow function is called, after the window has been removed from the screen. | |
WM_ENABLE | Sent after a window has been enabled or disabled. | |
WM_ENDSESSION | Tells an application that has responded nonzero to a WM_QUERYENDSESSION message whether the session is actually being ended. | |
WM_ENTERIDLE | Informs a window that a dialog box or menu is displayed and waiting for user action. | |
WM_ERASEBKGND | Sent when the window background needs to be erased. | |
WM_GETDLGCODE | Sent to an input procedure associated with a control. | |
Message | Description | |
WM_GETMINMAXINFO | Retrieves the maximized size of the window, the minimum or maximum tracking size of the window, and the maximized position of the window. | |
WM_GETTEXT | Copies the text that corresponds to a window. | |
WM_GETTEXTLENGTH | Retrieves the length (in bytes) of the text associated with a window. | |
WM_ICONERASEBKGND | Sent to an iconic window with a class icon when the background of the icon needs to be erased. | |
WM_KILLFOCUS | Sent immediately before a window loses the input focus. | |
WM_MENUCHAR | Notifies the window that owns the menu when the user presses a menu mnemonic character that doesn't match any of the predefined mnemonics in the current menu. |
|
WM_MENUSELECT | Notifies a window that the user has selected a menu item. | |
WM_MOVE | Sent when a window is moved. | |
WM_PAINT | Sent whenever Windows or an application makes a request to repaint a portion of an application's window. | |
WM_PAINTICON | Sent whenever Windows or an application makes a request to repaint a portion of an application's minimized (iconic) window. | |
WM_PARENTNOTIFY | Sent to the parent of a child window when the child window is created or destroyed. | |
WM_QUERYDRAGICON | Sent when the user is about to drag a minimized (iconic) window. | |
WM_QUERYENDSESSION | Sent when the user chooses the End Session command. | |
WM_QUERYNEWPALETTE | Sent when a window is about to receive the input focus to allow it to realize its logical color palette. | |
Message | Description | |
WM_QUERYOPEN | Sent to an icon when the user requests that the icon be opened into a window. | |
WM_QUIT | Indicates a request to terminate an application. | |
WM_SETFOCUS | Sent after a window receives the input focus. | |
WM_SETFONT | Changes the font used by a control for drawing text. | |
WM_SETREDRAW | Sets or clears the redraw flag, which determines whether or not updates to a control are displayed. | |
WM_SETTEXT | Sets the text of a window. | |
WM_SHOWWINDOW | Sent whenever a window is to be hidden or shown. | |
WM_SIZE | Sent after the size of a window has been changed. |