Home  >  Article  >  Operation and Maintenance  >  Win32 SDK Basics (9) Summary of Windows Common Messages

Win32 SDK Basics (9) Summary of Windows Common Messages

黄舟
黄舟Original
2017-06-06 10:03:593349browse


1. Windows message distribution

Message range

Description

0 ~ WM_USER – 1

System Message

WM_USER ~ 0x7FFF

Custom window classIntegerMessage

WM_APP ~ 0xBFFF

Application custom message

0xC000 ~ 0xFFFF

ApplicationStringMessage

> 0xFFFF

Reserved for future system applications


2. Commonly used Windows messages

##The application creates a windowWM_DESTROY0x0A window was destroyed##WM_MOVEWM_SIZEWM_ACTIVATEStatusWM_SETWM_KILLFOCUSWM_ENABLEWM_SETREDRAWWM_SETTEXTWM_GETTEXT##WM_QUIT0x0012Used to end program running or the application calls the Postquitmessage() function to generate this messageWM_QUERYOPEN0x0013When the user window is restored to its previous size and position, send this message to an iconWM_ERASEBKGND0x0014WM_SYSCOLORCHANGEWM_ENDSESSION##WM_SHOWWINDOW0x001CWhen a window will be activated, the activated window and the currently active (about to lose activation) window will receive this message. Which window should the application send this message to? Which one is activated and which one is inactive0x001D##0x0020If the mouse causes the cursor to move in a window and the mouse input When it is not captured, send a message to the windowWM_MOUSEACTIVATE0x0021When the cursor is in an inactive window and the user is pressing a mouse button, this message is sent to the current window##WM_CHILDACTIVATEWM_QUEUESYNC##WM_GETMINMAXINFOWM_PAINTICONWM_ICONERASEBKGNDNEXTDL##0x0041Displays that the memory is very lowWM_WINDOWPOSCHANGING0x0046This message is sent when the SetWindowPos() function is called to change the size and position of the window. Give the window WM_POWER0x0048When the system will Send this message to all processes when entering the suspend stateWM_ 0x004AThis message is sent when one application passes data to another application##WM_CANCELJOURNALWM_NOTIF of a certain control When the event ##WM_INPUTLANGCHANGEREQUEST WM_INPUTLANGCHANGEWM_TCARDWM_HELPWM_USERCHANGED##WM_NCHITTEST0x0084##WM_NCMBUTTONUP0x00A8This message is sent when the cursor is in the non-client area of ​​the window and the middle mouse button is released WM_NCMBUTTONDBLCL0x00A9 This message is sent when the cursor is in the non-client area of ​​the window and the middle mouse button is double-clicked##WM_SYSKEYDOWN0x0104Send this message to the window with keyboard focus when holding down the ALT key while pressing other keysWM_SYSKEYUP0x0105This message is sent to the owner of the keyboard when releasing a key while holding down the ALT key Focused windowWM_SYSCHAR##WM_SYSDEADCHARWM_INITDIALOGWM_COMMANDWM_SYSCOMMANDWM_TIMEREventWM_HSCROLL##WM_MENURBUTTONUP 0x0122This message is generated when releasing the right mouse button when the cursor is on a menu item##WM_MENUDRAGWM_MENUGETOBJECTWM_UNINITMENUPOPUPWM_MENUCOMMAND##WM_CHANGEUISTATE##WM_CTLCOLORLISTBOX0x0134Send this message to its parent window before drawing the list box control, which can be used to set the text and background color of the edit boxWM_CTLCOLORBTN0x0135Send before drawing WM_CTLCOLORDLG0x0136 Send this message to its parent window before drawing the dialog box. It can be used to set the text and background color of the edit boxWM_CTLCOLORSCROLLBAR0x0137Send this message to its parent window before drawing the scroll bar control. It can be used to set the scroll bar control. Text and background color##WM_CTLCOLORSTATICSend this message to its parent window before drawing the control. It can be used to set the text and background color of the static controlWM_MOUSEMOVE##0x0208Release middle mouse buttonWM_MBUTTONDBLCLKWM_MOUSEWHEEL##WM_PARENTNOTIFYWM_ENTERMENULOOPWM_EXITMENULOOPWM_SIZING##WM_DEVICECHANGE0x0219Send this message to an application or device when the device's hardware configuration changesWM_MDICREATE0x0220The application sends this message to multiple documents Client window to create an MDI child windowWM_MDIDESTROY0x0221The application sends this message to the multi-document client window to close an MDI child window##WM_MDIACTIVATEWM_MDIRWM_MDINEXTWM_MDIMAXIMIZEWM_MDITILEWM_MDICASCADE##WM_ENTERSIZEMOVEWM_EXITSIZEMOVEWM_DROPFILEWM_MDIREFRESHMENUWM_MOUSEHOVERWM_MOUSELEAVEWM_CUT300WM_COPY##WM_PASTE ##0x0309When When the clipboard contains data in the CF_OWNERDIPLAY format and the client area of ​​the clipboard observation window needs to be redrawn, send this message to the clipboard owner##WM_VSCROLLCLIPBOARD##WM_SIZECLIPBOARDWM_ASKCBFORMATNAME

Message name

Value

说 Ming

##WM_

NULL

0x0000

Empty message, this message will be ignored by the receiving window

WM_CREATE

0x0

001

002

0x0003

Move a window

0x0005

Change the size of a window

0x0006

A window is activated or deactivated

FOCUS

0x0007

After gaining focus

0x0008

Lost focus

0x000A

Produced when the application Enable state changes

##0x000B

Set whether the window can be redrawn

0x000C

An application sends this message to set the text of a window

0x000D

The application sends this message to copy the text of the corresponding window to the buffer

WM_GETTEXTLENGTH

0x000E

Get the length of the text associated with a window (excluding null characters)

WM_PAINT

0x000F

Ask a window to repaint itself

WM_CLOSE

0x0010

Sends a signal when a window or application is to be closed

WM_QUERYENDSESSION

##0x0011

The user chooses to end the conversation The box or application itself calls ExitWindows()

Function

##When the window background must be erased (such as when the window is resized)

0x0015

Sent when the system color changes This message is given to all top-level windows

0x0016

When the system process issues the WM_QUERYENDSESSION message, this message is sent to the application

##0x0018

This message is sent to this window when hiding or showing the window

##WM_ACTIVATEAPP

WM_FONTCHANGE

Send this message to all top-level windows when the system's font resource library changes

##WM_

TIME CHANGE

0x001E

Send this message to all top-level windows when the system time changes

WM_CANCELMODE

0x001F

Send this message to cancel an ongoing operation

WM_SETCURSOR

0x0022

Send this message to an MDI child window when the user clicks the title bar of this window, or when the window is activated, moved, or resized

0x0023

This message is generated by a computer-based The training program is sent and the user input message is separated through the Hook program of WH_JOURNALPALYBACK

0x0024

When the window is about to change its size or position, send this message to the window

0x0026

Send this message to the window when the window icon is about to be redrawn

0x0027

This is sent when the icon background must be redrawn before the icon in a minimized window is redrawn. Message to this window

##WM_
GCTL

0x0028

Send this message to a dialog box procedure to change the focus position

WM_SPOOLERSTATUS
0x002A

This message is issued when the print management queue adds or subtracts a

job

WM_DRAWITEM

0x002B

Sent when the appearance of Button, ComboBox, Listbox, Menu control changes This message is for the owners of these controls

##WM_MEASUREITEM

0x002C

When Button, ComboBox, list box, ListView, Menu items are created, send this message to the owner of the control

WM_

DELETEITEM

0x002D

When the ListBox or ComboBox is destroyed or when some items are sent via LB_DELETE

STRING, When the LB_RESETCONTENT, CB_DELETESTRING, CB_RESETCONTENT message is deleted, send this message to the owner of the control

WM_V

KEYTOITEM

0x002E

A ListBox control with the LBS_WANTKEYBOARDINPUT style sends this message to its owner, In response to the WM_KEYDOWN message

WM_CHARTOITEM

0x002F

A ListBox control with the LBS_WANTKEYBOARDINPUT style sends this message to its owner in response to the WM_CHAR message

WM_SETFONT

0x0030

When the application draws a control, this message is sent to obtain the font in which the text in the control is drawn

WM_GETFONT

0x0031

The application sends this message to get the font of the text drawn by the current control

WM_SETHOTKEY

0x0032

The application sends this message to associate a window with a hotkey

WM_GETHOTKEY

0x0033

The application sends this message to determine Whether the hotkey is associated with a certain window

WM_QUERYDRAGICON

0x0037

This message is sent to the minimized window. When this window is about to be dragged and dropped and there is no icon defined in its class, the application returns an icon or cursor handle. The system displays this icon or cursor when the user drags and drops the icon.

WM_COMPAREITEM

0x0039

Send this message to determine the ComboBox or ListBoxNewly addedThe relative position of the added item

##WM_

COMPACTING

COPY

DATA

0x004B

When a user cancels the program log activation state, send this message to the application

Y

0x004E

When a
has occurred or this control needs to get some information, send this message to its parent window

0x0050

When the user selects an input language, or the hotkey of the input language changes

0x0051

This message is sent to the affected top level when the application input language is changed. Window

0x0052

When the application has initialized The Windows Help routine sends this message to the application

0x0053

When the user presses F1, if a menu is activated, this message is sent to the menu associated with this window, otherwise it is sent to the window with focus. If there is currently no focus, this message is sent. Sent to the currently active window

0x0054

Send this message to all windows when the user has logged in or logged out. When the user logs in or logs out, the system updates The user's specific setting information, the system will send this message immediately when the user updates the settings

WM_NOTIFYFORMAT

0x0055

Common controls and their parent windows use this message to determine whether to use ANSI or UNICODE structure in the WM_NOTIFY message. Using this control can make a certain The control communicates with its parent control

WM_CONTEXTMENU

0x007B

When the user right-clicks in a window, this message is sent to the window

WM_STYLECHANGING

0x007C

When one or more styles of the window are about to call the SetWindowLong() function, send this message to the window

WM_STYLECHANGED

0x007D

This message is sent when one or more styles of the window are changed by calling the SetWindowLong() function Give the window

##WM_

DISPLAYCHANGE

0x007E

Send this message to all windows when the display resolution is changed

WM_GETICON

0x007F

Send this message to a window and return the handle of the large icon or small icon associated with a window

WM_SETICON

0x0080

The application sends this message to associate a new large or small icon with a window

WM_NCCREATE

0x0081

When a window first When created, this message is sent before the WM_CREATE message is sent

WM_NCDESTROY

0x0082

This message notifies a window that the non-client area is being destroyed

WM_NCCALCSIZE

0x0083

This message is sent when calculating the client area size and position of a window

This message is generated when moving the mouse, holding down or releasing the mouse

##WM_NCPAINT

0085

When the

frame of a window must be drawn, the application sends this message to the window

WM_NCACTIVATE

0x0086

Indicates whether the window is active or active by changing the non-client area of ​​a window When inactive, this message is sent to the window

WM_NCMOUSEMOVE

0x00A0

Send this message to the window when the cursor moves within the non-client area of ​​the window (window title bar and border)

WM_NCLBUTTONDOWN

0x00A1

This message is sent when the cursor is in the non-client area of ​​the window and the left mouse button is pressed

WM_NCLBUTTONUP

0x00A2

When the cursor is in the non-client area of ​​the window and the left mouse button is released Send this message

WM_NCLBUTTONDBLCLK

0x00A3

When the cursor is on This message is sent when the left mouse button is double-clicked in the non-client area of ​​the window

WM_NCRBUTTONDOWN

0x00A4

This message is sent when the cursor is in the non-client area of ​​the window and the right mouse button is pressed

WM_NCRBUTTONUP

0x00A5

This message is sent when the cursor is in the non-client area of ​​the window and the right mouse button is released

WM_NCRBUTTONDBLCLK

0x00A6

This message is sent when the cursor is in the non-client area of ​​the window and the right mouse button is double-clicked

WM_NCMBUTTONDOWN

0x00A7

When the cursor is in the non-client area of ​​the window and press This message is sent when the mouse is middle-clicked

WM_KEYDOWN

0x0100

Press a non-system key (press The "ALT" key was not pressed when the key was pressed)

WM_KEYUP

0x0101

Release a non-system key

##WM_CHAR

0x0102

Press a key and send this message when TranslateMessage() forwards WM_KEYDOWN

WM_DEADCHAR

0x0103

Release a key and send this message after TranslateMessage() forwards WM_KEYUP

##0x0106

When TranslateMessage( ) forwards WM_SYSKEYDOWN and sends this message to the window with keyboard focus

0x0107

Send this message to the window with keyboard focus after TranslateMessage() forwards WM_SYSKEYUP

0x0110

Send this message before the dialog box is displayed. This message is usually used to initialize the control and perform other tasks

0x0111

Select a window menu item or a control to send a message to its parent window or press This message is generated when a shortcut key

0x0112

Send this message to the window when selecting a window menu item or selecting to maximize or minimize

0x0113

Timer

0x0114

Send this message to the owner of the window and scroll bar when the horizontal scroll bar of the window generates a scroll event

WM_VSCROLL

0x0115

Send this message to the owner of the window and scroll bar when the vertical scroll bar of the window generates a scroll event

WM_INITMENU

0x0116

Sent when a menu is about to be activated Message, which occurs when a menu item is pressed or a menu shortcut key is pressed, which allows a program to change the menu before it is displayed

##WM_INITMENUPOPUP

0x0117

This message is sent when a

drop-down menu or submenu is about to be activated. It allows the menu to be modified without changing it before displaying. Entire menu

WM_MENUSELECT

0x011F

Select a menu item Send this message to the owner of the menu (usually the window)

WM_MENUCHAR

0x0120

When the menu has been activated and the user pressed a key (not a shortcut key), send this message to the owner of the menu

WM_ENTERIDLE

0x0121

Sends this message to its owner when a modal dialog box or menu enters the idle state. The idle state means that the message queue is empty after processing one or several previous messages

0x0123

Sends this message to the owner of the drag-and-drop menu when a menu item is dragged

0x0124

When the cursor moves into the menu item or moves from the center of the menu item Send this message to the owner of the drag-and-drop menu when reaching the top or bottom of a menu item

0x0125

This message is generated when the drop-down menu or submenu is destroyed

0x0126

This message is generated when the user selects a menu item

0x0127

The application sends this message to indicate that the user interface (UI) state should be changed

WM_UPDATEUISTATE

##0x0128

The application sends this message to change the specified window and its children. The user interface (UI) state of the window

WM_QUERYUISTATE

0x0129

The application sends this message to get the user interface (UI) status of a certain window

WM_CTLCOLORMSGBOX

0x0132

Send this message to its parent window before drawing the

message box. By responding to this message, the parent window can use the given handle of the relevant display device. To set the text and background color of the message box

WM_CTLCOLOREDIT

0x0133

Send this message to its parent window before drawing the edit control. It can be used to set the text and background color of the edit box

button

control This message is sent to its parent window and can be used to set the text and background color of the edit box

##0x0138

Drawing

static

0x0200

Mouse move

##WM_LBUTTONDOWN
0x0201

Press the left mouse button

WM_LBUTTONUP

0x0202

Release the left mouse button

WM_LBUTTONDBLCLK

0x0203

Double click the left mouse button

WM_RBUTTONDOWN

0x0204

Press the right mouse button

##WM_RBUTTONUP

0x0205

Release the right mouse button

WM_RBUTTONDBLCLK

0x0206

Double-click Right mouse button

WM_MBUTTONDOWN

0x0207

Press the middle mouse button Key

WM_MBUTTONUP

##0x0209

Double-click the middle mouse button

0x020A

Send this message to when the mouse wheel is rotated The currently focused window

0x0210

When When an MDI child window is created or destroyed, or when the cursor is on the child window and the user clicks the mouse button, this message is sent to its parent window

0x0211

Send this message to notify the application's main window process that it has entered menu mode

Loop

0x0212

Send this message to notify the application The main window process has exited the menu mode loop

0x0214

Send this message to the window when resizing the window. Through this message, the application can monitor or modify the window size and position

WM_CAPTURECHANGED

0x0215

When the window is set to not capture mouse events When , send this message to the window

WM_MOVING

0x0216

Send this message to the window when moving the window. Through this message, the application can monitor or modify the window size and position

##WM_POWERBROADCAST

0x0218

Send this message to an application to notify it about power management events

Driver

Program

0x0222

The application sends this message to the multi-document client window to notify the client window to activate another MDI child window. When the client window receives this message, it sends a WM_MDIACTIVE message to the MDI child window. window (not activated) to activate it

ESTORE

##0x0223

The application sends this message to the MDI client window to notify the child window to return to its original size

0x0224

The application sends this message to the MDI client window to activate the next or previous window

0x0225

The application sends this message to the MDI client window to maximize an MDI child window

0x0226

The application sends this message to the MDI client window to Rearrange all MDI sub-windows in tiling mode

0x0227

The application sends this message to the MDI client window to rearrange all MDI child windows in a cascading manner

WM_MDIICONARRANGE

0x0228

The application sends this message to the MDI client window to rearrange all minimized MDI child windows

WM_MDIGETACTIVE

0x0229

The application sends this message to the MDI client window to Find the handle of the active child window

WM_MDISETMENU

##0x0230

The application sends this message to the MDI client window to replace the subwindow's menu with the MDI menu

##0x0231

When the window enters the move or resize mode loop, send this message to the window

0x0232

Send this message to the window when it exits the move or resize mode loop

S

0x0233

When the user drags When moving a file, this message

0x0234

The application sends this message to the MDI client window to refresh the window menu

0x02A1

When the cursor hovers in the window client area for more than the time specified by TrackMouseEvent(), send this message to the window

0x02A3

When the cursor leaves the window client area for more than the time specified by TrackMouseEvent(), send this message to the window

0x0

App The program sends this message to an Edit Box or ComboBox to delete the currently selected text

0x0301

The application sends this message to an edit box or ComboBox to copy the currently selected text to the clipboard

0x0302

Applications send this message to an edit box or ComboBox to get data from the clipboard

WM_CLEAR

0x0303

The application sends this message to an edit box or ComboBox to clear the current selection

WM_UNDO

0x0304

The application sends this message to an Edit Box or ComboBox to undo the last operation

##WM_DESTROY

CLIPBOARD

0x0307

When EmptyClipboard() is called to clear the clipboard, this message is sent to the clipboard owner

WM_DRAWCLIPBOARD

0x0308

This message is sent to the first window in the clipboard watch chain when the contents of the clipboard change. It allows the clipboard watch window to be displayed. New contents of clipboard

WM_PAINTCLIPBOARD

0x030A

When the clipboard contains data in the CF_OWNERDIPLAY format and a vertical scroll bar event occurs in the clipboard observation window, the clipboard observation window sends this message to Clipboard owner

0x030B

When clipping The clipboard viewing window sends this message to the owner of the clipboard when the board contains data in the CF_OWNERDIPLAY format and the size of the client area of ​​the clipboard viewing window has changed

##0x030C

The clipboard observation window sends this message to the clipboard owner to obtain the name of the CF_OWNERDISPLAY clipboard format

WM_CHANGECBCHAIN
0x030D

When a window observes the chain from the clipboard This message is sent to the first window in the clipboard watch chain when removed

WM_HSCROLLCLIPBOARD
0x030E

When the clipboard contains data in the CF_OWNERDIPLAY format and a horizontal scroll bar event occurs in the clipboard observation window, the clipboard observation window sends this message to the clipboard owner

WM_QUERYNEWPALETTE
0x030F

Send this message to the window that is about to gain keyboard focus. This message gives the window a chance to implement its logical palette when it gains focus.

WM_PALETTEISCHANGING

0x0310

This message is sent to notify all applications when an application is about to implement its logical palette

WM_PALETTECHANGED

0x0311

The window that gets the focus implements it Send this message to all top-level and overlapping windows after the logical palette to

change the system palette

WM_HOTKEY

0x0312

This message is generated when the user presses a hotkey registered by RegisterHotKey()

WM_PRINT

0x0317

The application sends this message to the window, Requests the window to draw itself in the specified device context, usually the printer device context

WM_PRINTCLIENT

0x0318

The application sends this message to the window, requesting the window to draw the window client area in the specified device environment, usually the printer device environment

WM_APP

0x8000

Help users customize messages. Custom messages can be WM_APP+X, X is positive Integer

WM_USER

0x0400

Help users customize messages , the custom message can be WM_USER+X, X is a positive integer


3. Notification message - button

##BN_DOUBLECLICKEDBN_HILITE##BN_PAINTBN_UNHILITE

Message name

Description

BN_CLICKED

Click button

##BN_DISABLE

Button disabled

##Double click button

Highlight button

The button should be redrawn

The highlight should be removed



4. Notification message-combo box

##CBN_ERRSPACECombo box out of memoryCBN_KILLFOCUSCombo box lost input focusCBN_SELCHANGEAn item is selected in the combo boxCBN_SELENDCANCELThe user’s selection will be IgnoreCBN_SELENDOKUser's selection will be executedCBN_SETFOCUSCombo box gets input focus

5. Notification message-edit box

Message name

Description

CBN_CLOSEUP

The list box of the combo box is closed

CBN_DBLCLK

The user double-clicked a string

##CBN_DRO

PDOWN

The list box of the combo box is pulled down

CBN_EDITCHANGE

The user modified the text in the combo box

CBN_EDITUPDATE

Inside the combo box The text will be updated soon

##The user clicked Horizontal scroll bar##EN_KILLFOCUSEN_MAXTEXTEN_SETFOCUSEN_UPDATEEN_VSCROLL6. Notification message-list box

Message name

Description

EN_CHANGE

The text in the edit box has been updated

##EN_ERRSPACE

Insufficient memory in the edit box

EN_HSCROLL

Edit box loses input focus

The inserted content was truncated

The edit box gets the input focus

The text in the edit box will be updated

The user clicked the vertical scroll bar

Message nameLBN_DBLCLK##LBN_ERRSPACELBN_KILLFOCUS

Description

The user double-clicked an item

The list box is out of memory

The list box is losing Input focus

##LBN_SELCANCEL
User selection canceled

LBN_SELCHANGE
User selection will change

LBN_SETFOCUS
List box gets input focus

The above is the detailed content of Win32 SDK Basics (9) Summary of Windows Common Messages. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn