Windows message Overview

Source: Internet
Author: User
A message is a notification sent by windows to tell the application that something has happened. For example, if you click the mouse, change the window size, or press a key on the keyboard, Windows will send a message to the application. The message itself is passed to the application as a record, which contains the Message Type and other information. For example, for a message generated by clicking the mouse, this record contains the coordinates of the mouse. This record type is tmsg)

It is declared in a Windows unit as follows:
Type
Tmsg = packed record
Hwnd: hwnd; // window handle
Message: uint; // message constant identifier
Wparam: wparam; // additional information of a 32-bit message
Lparam: lparam; // additional information of a 32-bit message
Time: DWORD; // the time when the message was created.
PT: tpoint; // The cursor position when the message is created
End;

What are messages?
Do you think the information in a message record is the same as that in Greek? If so, let's take a look at the following explanation:
Hwnd 32-bit window handle. Windows can be any type of screen objects, because Win32 can maintain the handles of most visual objects (Windows, dialog boxes, buttons, edit boxes, etc ).
Message is used to distinguish the constant values of other messages. These constants can be pre-defined constants in Windows units or custom constants.
Wparam is a message-related constant value, or a handle to a window or control.
Lparam is usually a pointer to data in the memory. Because w p a r a m, l p a r a m, and p o I n t e r are both 3 and 2 bits,
Therefore, they can be converted to each other.

Wm_null =$ 0000;
Wm_create =$ 0001;
Application creation window
Wm_destroy =$ 0002;
A window is destroyed.
Wm_move =$ 0003;
Move a window
Wm_size =$ 0005;
Change the size of a window
Wm_activate =$ 0006;
A window is activated or inactive;
Wm_setfocus =$ 0007;
After getting focus
Wm_killfocus = $0008;
No focus
Wm_enable = $ 000a;
Enable status change
Wm_setredraw = $ 000b;
Set whether the window can be re-painted
Wm_settext = $ 000c;
The application sends this message to set the text of a window.
Wm_gettext = $ 000d;
The application sends this message to copy the text of the corresponding window to the buffer zone.
Wm_gettextlength = $ 000e;
Get the length of text related to a window (excluding empty characters)
Wm_paint = $ 000f;
Require a window to redraw itself
Wm_close = $0010;
Send a signal when a window or application is closed
Wm_queryendsession = $0011;
When the user selects the end dialog box or the program calls the exitwindows Function
Wm_quit =$ 0012;
Used to end the program running or when the program calls the postquitmessage Function
Wm_queryopen =$ 0013;
Send the message to an icon when the user window restores the previous size position.
Wm_erasebkgnd =$ 0014;
When the window background must be erased (for example, when the window size changes)
Wm_syscolorchange = $0015;
When the system color changes, send this message to all top-level windows.
Wm_endsession =$ 0016;
After the system process sends the wm_queryendsession message, the message is sent to the application,
Indicates whether the conversation ends.
Wm_systemerror = $0017;
Wm_showwindow =$ 0018;
This message is sent to the hidden or displayed window.
Wm_activateapp = $ 001c;
Which window of the application is activated and which is not activated;
Wm_fontchange = $ 001d;
This message is sent to all top-level windows when the font resource library of the system changes
Wm_timechange = $ 001e;
Send this message to all top-level windows when the system time changes
Wm_cancelmode = $ 001f;
Send this message to cancel an ongoing touch (Operation)
Wm_setcursor =$ 0020;
If the mouse causes the cursor to move in a window and the mouse input is not captured, a message is sent to a window.
Wm_mouseactivate =$ 0021;
When the cursor is in an inactive window and the user is pressing a key of the mouse to send this message to the current window
Wm_childactivate = $0022;
Send this message to the MDI subwindow. When the user clicks the title bar of this window, or the window is activated, move and change the size.
Wm_queuesync =$ 0023;
This message is sent by a computer-based training program through the wh_journalpalyback hook Program
Separates user input messages
Wm_getminmaxinfo =$ 0024;
This message is sent to the window when it is about to change the size or position;
Wm_painticon = $0026;
Send to minimize window when its icon is to be repainted
Wm_iconerasebkgnd = $0027;
This message is sent to a minimal window, only when its background must be re-painted before the icon is painted.
Wm_nextdlgctl = $0028;
Send this message to a dialog box program to change the focus position
Wm_spoolerstatus = $ 002a;
This message is sent whenever a job is added or removed in the print management queue.
Wm_drawitem = $ 002b;
Send a message when the visual appearance of Button, ComboBox, ListBox, and menu changes
This message is sent to the owner of these empty parts.
Wm_measureitem = $ 002c;
When a button, combo box, list box, List View control, or menu item is created
Send this message to the control owner

Wm_deleteitem = $ 002d;
When the list box or combo box is destroyed or some items are deleted, messages are sent through lb_deletestring, lb_resetcontent, cb_deletestring, or cb_resetcontent.
Wm_vkeytoitem = $ 002e;
This message has an lbs_wantkeyboardinput style sent to its owner to respond to the wm_keydown message.
Wm_chartoitem = $ 002f;
This message is sent to its owner by a list box in the lbs_wantkeyboardinput style to respond to the wm_char message.
Wm_setfont =$ 0030;
When drawing text, the program sends this message to obtain the color used by the control.
Wm_getfont =$ 0031;
The application sends this message to obtain the font of the text drawn by the current control.
Wm_sethotkey =$ 0032;
The application sends this message to connect a window to a hotkey.
Wm_gethotkey =$ 0033;
The application sends this message to determine whether the hotkey is associated with a window.
Wm_querydragicon =$ 0037;
This message is sent to the minimal window. When the window is to be dragged and its class does not have a defined icon, the application can return an icon or a cursor handle, this icon or cursor is displayed when you drag and drop an icon.
Wm_compareitem =$ 0039;
Send this message to determine the relative position of the newly added items in ComboBox or ListBox
Wm_getobject = $ 003d;
Wm_compacting =$ 0041;
The Display memory is very small.
Wm_windowposchanging = $0046;
When the size and position of the window to which the message is sent are about to be changed, call the setwindowpos function or other window management functions.
Wm_windowposchanged = $0047;
When the size and position of the window to which the message is sent have been changed, call the setwindowpos function or other window management functions.
Wm_power = $0048; (applicable to 16-bit Windows)
This message is sent when the system is about to suspend
Wm_copydata = $ 004a;
This message is sent when an application transmits data to another application.
Wm_canceljournal = $ 004b;
When a user cancels the activation status of the program log, submit the message to the program
Wm_notify = $ 004e;
When an event of a control has occurred or the control needs to obtain some information, send the message to its parent window.
Wm_inputlangchangerequest = $0050;
When the user selects an input language or the hotkey of the input language changes
Wm_inputlangchange = $0051;
Send this message to the affected top-level window when the platform site has been changed
Wm_tcard =$ 0052;
This message is sent to the application when the program has initialized the Windows Help routine.
Wm_help = $0053;
This message indicates that the user presses F1. If a menu is activated, the user sends the message to the menu associated with this window. Otherwise
Send to a window with focus. If there is no focus at present, send the message to the current active window.
Wm_userchanged =$ 0054;
After a user has logged on or exited, the system sends this message to all windows. When the user logs on or exits, the system updates the user's details.
Setting information. The system sends the message immediately when the user updates the setting;
Wm_policyformat = $0055;
Public controls, custom controls, and their parent Windows use this message to determine whether the control uses the ANSI or Unicode Structure
In the wm_notify message, this control enables communication between a control and its parent control.
Wm_contextmenu = $ 007b;
Right-click a user in a window and send the message to this window.
Wm_stylechanging = $ 007c;
This message is sent to the window when the setwindowlong function is called to change the style of one or more windows.
Wm_stylechanged = $ 007d;
This message is sent to the window when one or more window styles of the setwindowlong function are called.
Wm_displaychange = $ 007e;
Send this message to all windows when the resolution of the monitor changes
Wm_geticon = $ 007f;
This message is sent to a window to return the handle of the large icon or small icon associated with a window;
Wm_seticon =$ 0080;
The program sends this message to associate a new large or small icon with a window;
Wm_nccreate = $0081;
When a window is created for the first time, the message is sent before the wm_create message is sent;
Wm_ncdestroy = $0082;
This message notifies a window that the non-customer zone is being destroyed.
Wm_nccalcsize = $0083;
Send this message when the customer region of a window must be calculated
Wm_nchittest = $0084; // occurs when you move the mouse, hold down or release the mouse.
Wm_ncpaint =$ 0085;
The program sends this message to a window when its frame (window) must be drawn;
Wm_ncactivate =$ 0086;
This message is sent to a window only when its non-customer zone needs to be changed to show whether it is active or not;
Wm_getdlgcode = $0087;
Send this message to a control associated with the dialog box program. The Widdows control orientation key and Tab key enable the input to enter the control.
By responding to the wm_getdlgcode message, the application can treat it as a special input control and process it.
Wm_ncmousemove = $00a0;
When the cursor moves in a non-customer area of a window, the message is sent to this window. // The non-customer area is the title bar and window of the form.
Border body
Wm_nclbuttondown = $00a1;
This message is submitted when you press the left mouse button in a non-customer area of a window.
Wm_nclbuttonup = $00a2;
When the user releases the left mouse button and a window with the cursor sends the message in non-customer Zone 10;
Wm_nclbuttondblclk = $00a3;
When you double-click the left mouse button and a window with the cursor sends this message in the non-customer Zone 10
Wm_ncrbuttondown = $00a4;
This message is sent when you press the right mouse button and the cursor is in a non-customer area of the window.
Wm_ncrbuttonup = $00a5;
This message is sent when the user releases the right mouse and the cursor is in a non-customer area of the window.
Wm_ncrbuttondblclk = $00a6;
When you double-click and Right-click a window, the cursor will send the message in non-customer Zone 10.
Wm_ncmbuttondown = $00a7;
This message is sent when you press the middle mouse button and the cursor is in a non-customer area of the window.
Wm_ncmbuttonup = $00a8;
This message is sent when the user releases the middle mouse button and the cursor is in a non-customer area of the window.
Wm_ncmbuttondblclk = $00a9;
This message is sent when you double-click the middle mouse button and the cursor is in a non-customer area of the window.

Wm_keyfirst =$ 0100;
Wm_keydown =$ 0100;
// Press the next key
Wm_keyup =$ 0101;
// Release a key
Wm_char = $0102;
// Press a key and the wm_keydown and wm_keyup messages have been sent.
Wm_deadchar =$ 0103;
Send this message to the window with focus when you use the translatemessage function to translate the wm_keyup message
Wm_syskeydown = $0104;
When you press the Alt key and other keys, submit the message to the window with focus;
Wm_syskeyup =$ 0105;
When you release a key and press the Alt key, submit the message to the window with focus
Wm_syschar =$ 0106;
When the wm_syskeydown message is translated by the translatemessage function, submit the message to the window with focus
Wm_sysdeadchar =$ 0107;
When the wm_syskeydown message is translated by the translatemessage function, this message is sent to the window with focus
Wm_keylast =$ 0108;
Wm_initdialog =$ 0110;
Send this message to a dialog box program before it is displayed. This message is usually used to initialize the control and execute other tasks.
Wm_command =$ 0111;
When you select a menu command item or when a control sends a message to its parent window, a shortcut key is translated
Wm_syscommand =$ 0112;
This message is received when you select a command in the window menu or when you choose to maximize or minimize it.
Wm_timer = $0113; // a timer event occurs.
Wm_hscroll = $0114;
When a standard horizontal scroll bar of a window generates a rolling event, this message is sent to that window and the control that owns it.
Wm_vscroll = $0115;
When a standard vertical scroll bar of a window generates a rolling event, send this message to that window, and send it to the control wm_initmenu that owns it = $0116;
This message is sent when a menu is to be activated. It occurs in a user menu bar or presses a menu key, which allows the program to change the menu before display.
Wm_initmenupopup =$ 0117;
This message is sent when a drop-down menu or sub-menu is to be activated. It allows the program to change the menu before it is displayed, instead of changing all
Wm_menuselect = $ 011f;
This message is sent to the menu owner (usually a window) when a menu item is selected)
Wm_menuchar = $0120;
When the menu has been activated, the user presses a key (different from the acceleration key) and sends the message to the menu owner;
Wm_enteridle =$ 0121;
When a modal dialog box or menu enters the no-load status, this message is sent to its owner, when a modal dialog box or menu enters the no-load status, it waits for no messages in the queue after processing one or more previous messages.
Wm_menurbuttonup =$ 0122;
Wm_menudrag =$ 0123;
Wm_menugetobject =$ 0124;
Wm_uninitmenupopup =$ 0125;
Wm_menucommand =$ 0126;
Wm_changeuistate = $0127;
Wm_updateuistate =$ 0128;
Wm_queryuistate = $0129;
Wm_ctlcolormsgbox = $0132;
Send the message to the owner window of the message box before drawing a message box in windows, in the owner window, you can set the text and background color of the message box by using the given handle of the display device.
Wm_ctlcoloredit = $0133;
The parent window to which the message is sent when an edit control is to be drawn, in the owner window, you can set the text and background color of the edit box by using the given handle of the display device.
Wm_ctlcolorlistbox =$ 0134;
When a list box control sends this message to its parent window before being drawn; by responding to this message, in the owner window, you can set the text and background colors of the list box by using the given handle of the display device.
Wm_ctlcolorbtn = $0135;
When a button control is to be drawn, this message is sent to its parent window. By responding to this message, in the owner window, you can set the text and background color of the button by using the handle of the specified display device.
Wm_ctlcolordlg =$ 0136;
When a dialog box control sends this message to its parent window before being drawn; by responding to this message, in the owner window, you can set the text background color of the dialog box by using the corresponding display device handle.
Wm_ctlcolorscrollbar = $0137;
When a scroll bar control is to be drawn, this message is sent to its parent window. By responding to this message, the owner window can set the background color of the scroll bar by using the corresponding display device handle.
Wm_ctlcolorstatic =$ 0138;
When a static control is to be drawn, this message is sent to its parent window. By responding to this message, in the owner window, you can set the text and background color of the static control by using the given handle of the display device.
Wm_mousefirst =$ 0200;
Wm_mousemove =$ 0200;
// Move the mouse

// Move the mouse
Wm_lbuttondown =$ 0201;
// Press the left mouse button
Wm_lbuttonup =$ 0202;
// Release the left mouse button
Wm_lbuttondblclk =$ 0203;
// Double-click the left mouse button
Wm_rbuttondown = $0204;
// Right-click
Wm_rbuttonup = $0205;
// Right-click release
Wm_rbuttondblclk = $0206;
// Right-click
Wm_mbuttondown = $0207;
// Press the middle mouse button
Wm_mbuttonup =$ 0208;
// Release the middle mouse button
Wm_mbuttondblclk =$ 0209;
// Double-click the middle mouse button
Wm_mousewheel = $ 020a;
This message is sent when the mouse wheel is turned with a focus control
Wm_mouselast = $ 020a;
Wm_parentnotify = $0210;
When the MDI child window is created or destroyed, or the user presses the mouse key and the cursor sends this message to its parent window
Wm_entermenuloop = $0211;
The main window of the notification application that has entered the menu loop mode
Wm_exitmenuloop =$ 0212;
The notification application's main window that has exited the menu loop mode
Wm_nextmenu = $0213;
Wm_sizing = 532;
When the user is adjusting the window size, send this message to the window; through this message application, you can monitor the window size and position and modify them
Wm_capturealtered = 533;
Send this message to the window when it loses the captured mouse;
Wm_moving = 534;
This message is sent when you move the window. You can use this message application to monitor the window size and position and modify them;
Wm_powerbroadcasting = 536;
This message is sent to the application to notify it of power management events;
Wm_devicechange = 537;
Send this message to the application or device driver when the hardware configuration of the device changes.
Wm_ime_startcomposition = $ 010d;
Wm_ime_endcomposition = $ 010e;
Wm_ime_composition = $ 010f;
Wm_ime_keylast = $ 010f;
Wm_ime_setcontext = $0281;
Wm_ime_policy = $0282;
Wm_ime_control = $0283;
Wm_ime_compositionfull =0284;
Wm_ime_select =$ 0285;
Wm_ime_char = $0286;
Wm_ime_request =0288;
Wm_ime_keydown =$ 0290;
Wm_ime_keyup =$ 0291;
Wm_mdicreate = $0220;
The application sends this message to the customer window of multiple documents to create an MDI subwindow.
Wm_mdidestroy =$ 0221;
The application sends this message to the customer window of multiple documents to close an MDI subwindow.
Wm_mdiactivate =$ 0222;
The application sends this message to the customer window of multiple documents to notify the customer window to activate another MDI subwindow. When the customer window receives this message, it sends the wm_mdiactive message to the MDI subwindow (not activated) activate it;
Wm_mdirestore =$ 0223;
The program sends this message to the MDI customer window so that the sub-window can be restored from the maximum to the original size.
Wm_mdinext =$ 0224;
The program sends this message to the MDI customer window to activate the next or previous window.
Wm_mdimaximize =$ 0225;
The program sends this message to the MDI customer window to maximize an MDI subwindow;
Wm_mditile =$ 0226;
The program sends this message to the MDI customer window to rearrange all MDI child windows in Tiled Mode
Wm_mdicascade = $0227;
The program sends this message to the MDI customer window and rearranges all MDI child windows in cascade mode.
Wm_mdiiconarrange =$ 0228;
The program sends this message to the MDI customer window to rearrange all the minimized MDI child windows.
Wm_mdigetactive = $0229;
The program sends this message to the MDI customer window to find the handle of the activated Child Window.
Wm_mdisetmenu =0230;
The program sends this message to the MDI customer window, replacing the sub-Window Menu With the MDI menu

Wm_entersizemove = $0231;
Wm_exitsizemove =$ 0232;
Wm_dropfiles =$ 0233;
Wm_mdirefreshmenu =0234;
Wm_mousehover = $02a1;
Wm_mouseleave = $02a3;
Wm_cut = $0300;
The program sends this message to an edit box or ComboBox to delete the selected text.
Wm_copy =$ 0301;
The program sends this message to an edit box or ComboBox to copy the selected text to the clipboard.
Wm_paste =$ 0302;
The program sends this message to editcontrol or ComboBox to obtain data from the clipboard.
Wm_clear=$ 0303;
The program sends this message to editcontrol or ComboBox to clear the selected content;
Wm_undo =$ 0304;
The program sends this message to editcontrol or ComboBox to cancel the last operation.
Wm_renderformat = $0305;

Wm_renderallformats = $0306;
Wm_destroyclipboard =$ 0307;
This message is sent to the clipboard owner when the enptyclipboard function is called.
Wm_drawclipboard =$ 0308;
This message is sent to the first window of the clipboard observation chain when the content of the clipboard changes; it allows the clipboard observation window
Display the new content of the clipboard;
Wm_paintclipboard =$ 0309;
When the Clipboard contains data in the cf_ownerdiplay format and the client area of the clipboard observation window needs to be re-painted;
Wm_vscrollclipboard = $ 030a;
Wm_sizeclipboard = $ 030b;
When the Clipboard contains data in the cf_ownerdiplay format and the size of the client area in the clipboard observation window has changed, the message is sent to the clipboard owner through the clipboard observation window;
Wm_askcbformatname = $ 030c;
Send this message to the clipboard owner in the clipboard observation window to request the name of the clipboard in cf_ownerdisplay format.
Wm_changecbchain = $ 030d;
Send this message to the first window of the clipboard observation chain when a window is moved from the clipboard observation chain;
Wm_hscrollclipboard = $ 030e;
This message is sent to the clipboard owner through a clipboard observation window; it occurs when the Clipboard contains data in the cfownerdispaly format and an event is on the horizontal scroll bar of the clipboard observation window; the owner should scroll the clipboard image and update the value of the scroll bar;
Wm_querynewpalette = $ 030f;
This message is sent to the window that will receive the focus, which gives the window the opportunity to implement its logical palette when receiving the focus.
Wm_paletteischanging =$ 0310;
This message notifies all applications when an application is about to implement its logical palette
Wm_palettechanged = $0311;
This message is sent to all top-level and overlapping windows after implementing its logical palette in a window with focus to change the system palette.
Wm_hotkey =$ 0312;
This message is submitted when you press the hotkey registered by the registerhotkey function.
Wm_print = 791;
The application sends this message only when Windows or other applications send a request requesting to draw a part of an application;
Wm_prints client = 792;
Wm_handheldfirst = 856;
Wm_handheldlast = 863;
Wm_penwinfirst =$ 0380;
Wm_penwinlast = $ 038f;
Wm_coalesce_first = $0390;
Wm_coalesce_last = $ 039f;
Wm_dde_first = $03e0;
Wm_dde_initiate = wm_dde_first + 0;
A dde client program submits this message and starts a session with the server program to respond to the specified program and topic name;
Wm_dde_terminate = wm_dde_first + 1;
A dde application (whether a client or server) submits this message to terminate a session;
Wm_dde_advise = wm_dde_first + 2;
A dde client program submits this message to a DDE Service Program to request the server to update the data whenever the data item changes.
Wm_dde_unadvise = wm_dde_first + 3;
A dde client notifies a DDE Service Program through this message that it does not update a specified item or an item in a special clipboard format.
Wm_dde_ack = wm_dde_first + 4;
This message notifies a DDE (Dynamic Data Exchange) program that it has received and is processing wm_dde_poke, wm_dde_execute, wm_dde_data, wm_dde_advise, wm_dde_unadvise, or wm_dde_initiat messages
Wm_dde_data = wm_dde_first + 5;
A dde Service Program submits this message to the DDE client program to transmit a data item to the customer or to notify the customer of an available data item.
Wm_dde_request = wm_dde_first + 6;
A dde client program submits this message to a DDE Service Program to request the value of a data item;
Wm_dde_poke = wm_dde_first + 7;
A dde client program submits the message to a DDE Service Program. The client uses the message to request the server to receive an unapproved data item. The server replies to the wm_dde_ack message to indicate whether the server receives the data item;
Wm_dde_execute = wm_dde_first + 8;
A dde client program submits this message to a DDE Service Program to send a string to the server for processing like a serial command. The server responds by submitting a wm_dde_ack message;
Wm_dde_last = wm_dde_first + 8;
Wm_app =$ 8000;
Wm_user =$ 0400;
This message can help the application customize private messages;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.