Detailed usage of window message book [add to favorites]

Source: Internet
Author: User
Windows message Overview
 
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 called tmsg, which 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 object, because Win32 can maintain most
The handle of the object (window, dialog box, button, edit box, etc ). Message is used to distinguish the constant values of other messages. These constants can be pre-defined constants in windows
It can be a custom constant.
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. Since wparam, lparam, and pointer are both 32-bit, they can be converted to each other.

Wm_null = $0000 //
Wm_create = $0001 // create a window for the Application
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 obtaining the focus
Wm_killfocus = $0008 // lost focus
Wm_enable = $ 000a // change the Enable status
Wm_setredraw = $ 000b // you can specify whether the window can be repainted.
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.
Wm_gettextlength = $ 000e // get the length of the text related to a window (excluding empty characters)
Wm_paint = $ 000f // requires a window to redraw itself
Wm_close = $0010 // send a signal when a window or application is to close
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 this message to an icon when the user window restores its 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 // when the system process sends the wm_queryendsession message, the message is sent to the application to notify it of the end of the conversation.
Wm_systemerror = $0017 //
Wm_showwindow = $0018 // when the hidden or displayed window is sent to this window
Wm_activateapp = $ 001c // send this message to the application. Which window is activated and which one is not activated;
Wm_fontchange = $ 001d // send this message 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 // send a message to a window if the mouse causes the cursor to move in a window and the mouse input is not captured
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 and the user input message is separated by the wh_journalpalyback hook program.
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 the minimization window when its icon is to be repainted
Wm_iconerasebkgnd = $0027 // This message is sent to a minimization window, only when its background must be repainted 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 // This message is sent to the owner of these empty parts when the visual appearance of button, ComboBox, ListBox, and menu changes
Wm_measureitem = $ 002c // when a button, combo box, list box, List View control, or menu item is created, this message is sent to the control owner.
Wm_deleteitem = $ 002d // when the list box or combo box is destroyed or when 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 // The message is sent to the minimal window. When the window is to be dragged and its class has no defined icon, the application can
Returns the handle of an icon or cursor. 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 program log activation status, 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 key 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 // send this message to the application when the program has initialized the Windows Help routine
Wm_help = $0053 // The 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 // when the user has logged on or exited, send 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 control. The custom control and its parent window 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 // when you right-click a window, the message is sent to the window.
Wm_stylechanging = $ 007c // send this message to the window when you call the setwindowlong function to change the style of one or more windows
Wm_stylechanged = $ 007d // send this message to the window when one or more windows 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 icon or small icon with a window;
Wm_nccreate = $0081 // when a window is created for the first time, this message is sent before the wm_create message is sent;
Wm_ncdestroy = $0082 // This message notifies a window in which non-customer zones are being destroyed.
Wm_nccalcsize = $0083 // send this message when the customer region of a window must be calculated
Wm_nchittest = $0084 // move the mouse, hold down or release the mouse
Wm_ncpaint = $0085 // The program sends this message to a window when the frame of the 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 the message is activated 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 this 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, this 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 the cursor sends the message in a window outside the customer Zone 10;
Wm_nclbuttondblclk = $00a3 // when you double-click the left mouse button and a window with the cursor to send this message in non-customer Zone 10
Wm_ncrbuttondown = $00a4 // This message is sent when you right-click the user 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 right-click a user and a window with the cursor sends this 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 message wm_keydown and wm_keyup has 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 the user releases a key and the Alt key is pressed, the message is submitted 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, send this message 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 the user selects a command in the window menu or when the user selects maximize or minimize.
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, this message is sent to that window and the control wm_initmenu with it is sent to $0116 //
This message is sent when a menu is about to be activated. It occurs in a user menu bar or presses a menu key, which allows
The program changes the menu before display.
Wm_initmenupopup = $0117 // send this message 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
Change all
Wm_menuselect = $ 011f // send this message to the menu owner when a menu item is selected (usually a window)
Wm_menuchar = $0120 // when the menu has been activated, the user presses a key (different from the acceleration key) and sends this message to the menu owner;
Wm_enteridle = $0121 // when a modal dialog box or menu enters the idle state, 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 this message to the owner window of the message box before drawing a message box in windows. In response to this message, the owner window can
Set the text and background color of the message box by using the handle of the specified display device.
Wm_ctlcoloredit = $0133 // send this message to its parent window when an edit control is to be drawn. In response to this message, the owner window can
Set the text and background color of the edit box by using the handle of the specified display device.
Wm_ctlcolorlistbox = $0134 // when a list box control is to be drawn, send this message to its parent window; by responding to this message, the owner window can
Set the text and background color of the list box by using the handle of the specified display device.
Wm_ctlcolorbtn = $0135 // send this message to its parent window when a button control is to be drawn. In response to this message, the owner window 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 is to be drawn, send this message to its parent window; by responding to this message, the owner window can
Set the text background color of the dialog box by using the handle of the specified display device.
Wm_ctlcolorscrollbar = $0137 // send this message to its parent window when a scroll bar control is to be drawn. In response 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 // The parent window to which the message is sent when a static control is to be drawn. In response to this message, the owner window can
Set the text and background color of the static control by using the handle of the given display device.
Wm_mousefirst =$ 0200 //
Wm_mousemove = $0200 // 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 to release
Wm_rbuttondblclk = $0206 // right-click the mouse
Wm_mbuttondown = $0207 // press the middle mouse button
Wm_mbuttonup = $0208 // release the middle mouse button
Wm_mbuttondblclk = $0209 // double-click the key
Wm_mousewheel = $ 020a // The control with the current focus is sent when the mouse wheel turns
Wm_mouselast = $ 020a //
Wm_parentnotify = $0210 // The parent window to which the message is sent when the child window of the MDI is created or destroyed, or the user presses the mouse key and the cursor sends the message to the Child Window.
Wm_entermenuloop = $0211 // The main window for the notification application that has entered the menu loop mode
Wm_exitmenuloop = $0212 // The main window of the notification application that has exited the menu loop mode
Wm_nextmenu = $0213 //
Wm_sizing = 532 // when the user is adjusting the window size, send the message to the window. The message application can monitor the window size and position.
You can also modify them.
Wm_capturechanged = 533 // send this message to the window when it loses the captured mouse;
Wm_moving = 534 // This message is sent when the user moves the window. The message application can monitor the window size and position.
You can also modify them;
Wm_powerbroadcast = 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 device's hardware configuration 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 multi-document customer window to create an MDI subwindow
Wm_mdidestroy = $0221 // The application sends this message to the multi-document customer window 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
After the message is sent, it sends the wm_mdiactive message to the MDI subwindow (not activated) to activate it;
Wm_mdirestore = $0223 // The program sends this message to the MDI customer window so that the subwindow is 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 locate the handle of the activated subwindow.
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 get 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 // send this message to the clipboard owner when the enptyclipboard function is called
Wm_drawclipboard = $0308 // send this message 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 through 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. This message 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_printclient = 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 the 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 requesting the server to update the data item whenever it changes
Wm_dde_unadvise = wm_dde_first + 3 // a dde client notifies a DDE Service program not to update the specified item or a special clipboard format item.
Wm_dde_ack = wm_dde_first + 4 // This message notifies a DDE (Dynamic Data Exchange) program that it has received and is processing the wm_dde_poke, wm_dde_execute, wm_dde_data, begin, begin, or wm_dde_initiat
Wm_dde_data = wm_dde_first + 5 // a dde Service Program submits this message to the DDE client program to pass a data item to the customer or 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 and prompts 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 the 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;

//////////////////////////////////////// /////////////////////////////
A notification message refers to a message in which a subcontrol in a window has something to do.
Parent window. The notification message only applies to standard window controls such as buttons, list boxes, Combo boxes, edit boxes, and Windows 95
Controls such as tree view and list view. For example, click or double-click a control, select some text from the control, and
The scroll bar generates a notification message.

Button
Bn_clicked // The user clicked the button.
Bn_disable // The button is disabled.
Bn_doubleclicked // double-click the button.
Bn_hilite // The button is highlighted by the user.
Bn_paint // The button should be repainted
Bn_unhilite // highlight should be removed

Combo box
Cbn_closeup // The list box of the combo box is closed.
Cbn_dblclk // you double-click a string
Cbn_dropdown // The list box of the combo box is pulled out.
Cbn_editchange // you have modified the text in the edit box.
Cbn_editupdate // The text in the edit box is about to be updated.
Cbn_errspace // The combo box has insufficient memory.
Cbn_killfocus // The combo box loses the input focus.
Cbn_selchange // select an item in the combo box
Cbn_selendcancel // the user's selection should be canceled
Cbn_selendok // the user's choice is legal
Cbn_setfocus // The combo box obtains the input focus.

Edit box
En_change // The text in the edit box has been updated.
En_errspace // insufficient memory in the editing box
En_hscroll // the user clicks the horizontal scroll bar
En_killfocus // The edit box is losing the input focus.
En_maxtext // The inserted content is truncated.
En_setfocus // The edit box to get the input focus
En_update // The text in the edit box will be updated
En_vscroll // The message meaning of the vertical scroll bar clicked by the user

List box
Lbn_dblclk // you double-click an item
Lbn_errspace // insufficient memory in the list box
Lbn_killfocus // The list box is losing the input focus.
Lbn_selcancel // select canceled
Lbn_selchange // select another item
Lbn_setfocus // list box to get the input focus

××××××××××××××××××××××××××××××××××××××××××× ×
For more information, see:
Message. PAS in Delphi
Windows. h in VC/C ++ Builder
Win32 message documentation
××××××××××××××××××××××××××××××××××××××××××× ×

 

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.