|
Know about its power management events
Wm_devicechange when the hardware configuration of the device changes
Send this message to the application or device driver
The wm_mdidestroy application sends this message to multiple files.
To close an MDI child window.
The wm_mdiactivate application sends this message to multiple files.
Notify the customer window of the customer window to activate another MDI subwindow. When the customer window receives the message, it sends the wm_mdiactive message to the MDI subwindow (not activated) to activate it.
The wm_mdirestore program sends this message to the MDI customer.
The window allows the sub-window to be restored from the maximum to the original size.
The wm_mdinext program sends this message to the MDI client.
Activate the next or previous window
The wm_mdimaximize program sends this message to the MDI client.
Window to maximize an MDI subwindow
The wm_mditile program sends this message to the MDI client.
Rearrange all MDI child windows in Tiled Mode
The wm_mdicascade program sends this message to the MDI client.
Window re-arrange all MDI child windows in cascade Mode
The wm_mdiiconarrange program sends this message to the MDI customer window to rearrange all the minimized MDI child windows.
The wm_mdigetactive program sends this message to the MDI client.
Window to find the handle of the activated sub-Window
The wm_mdisetmenu program sends this message to the MDI client.
Replace the Child Window Menu With the MDI menu
The wm_cut program sends this message to an edit box or ComboBox to delete the selected text.
The wm_copy program sends this message to an edit box or ComboBox to copy the selected text to the clipboard.
The wm_paste program sends this message
Obtain data from the clipboard for editcontrol or ComboBox.
The wm_clear program sends this message
Clears the selected content for editcontrol or ComboBox.
The wm_undo program sends this message to editcontrol or ComboBox to cancel the last operation.
Wm_destroyclipboard send this message to the clipboard owner when the enptyclipboard function is called.
Wm_drawclipboard when the content of the clipboard changes
Send this message to the first window of the clipboard observation chain. It allows the clipboard observation window to display new content of the clipboard.
Wm_paintclipboard when the Clipboard contains data in the cf_ownerdiplay format and the client area of the clipboard observation window needs to be repainted
Wm_sizeclipboard when the Clipboard contains data in the cf_ownerdiplay format and the size of the client area in the clipboard observation window has changed
This message is sent to the clipboard owner through the clipboard observation window.
Wm_askcbformatname is sent through the clipboard observation window
This message is sent to the clipboard owner to request the name of the clipboard in cf_ownerdisplay format.
Wm_changecbchain when a window is observed from the clipboard
Send this message to the first window of the clipboard observation chain when the chain is moved in.
Wm_hscrollclipboard the 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 occurs 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 this message is sent to the address to be received
Vertex window, which enables the window to implement its logical palette when receiving the focus.
Wm_paletteischanging this message notifies all applications when an application is about to implement its logical palette
Wm_palettechanged
The window implements its logical palette and sends this message to all top-level and overlapping windows to change the system palette.
Wm_hotkey: this message is submitted when you press the hotkey registered by the registerhotkey function.
The wm_print application sends this message only when
Windows or other applications send a request to draw part of an application
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// ///
Sendmessage Function Description: sends a specified message to one or more windows. This function is used to call the window process specified by the window. It is not returned until the Window Process completes message processing. High quality programming
. Function prototype:
Lresult sendmessage (
Hwnd, // target window handle
Uint MSG, // message to be sent
Wparam, // The first message Parameter
Lparam // The second Message Parameter
);
. Parameters:
Hwnd
Window handle for receiving messages during the window process. If this parameter is hwnd_broadcast, the message is sent to all top-level windows of the system, including invalid or invisible non-self-owned windows, overwritten windows, and pop-up windows. Messages are not sent to subwindows.
MSG
Specifies the message to be sent;
Wparam
Specify the specific information of the additional message;
Lparam
Specify the specific information of the additional message.
. Return Value:
The Return Value Returns the message processing result, which depends on the sent message.
. Note:
Applications that need to communicate in hwnd_broadcast mode should use the registerwindowmessage function to obtain unique messages for inter-Application Communication.
If the specified window is created through the call thread, the window process is called immediately as a subroutine. If the specified window is created by calling different threads, the system switches to this thread and calls the appropriate window process. Messages between threads can only be retrieved by the receiving thread.Code. The sending thread will be blocked until the receiving thread finishes processing the message.
Windows CE: Windows CE does not support all messages supported by Windows desktop. Before using the sendmessage function, check whether the sent message is supported by Windows CE.
. Environment:
Windows NT: 3.1 or later;
Windows: 95 or later;
Windows CE: 1.0 or later;
Header file: winuser. h;
Input Library: user32.lib;
UNICODE: Unicode and ANSI are implemented in windows.
. Sample Code:
Case wm_keydown: Switch (wparam) {Case vk_home: sendmessage (hwnd, wm_vscroll, sb_top, 0); break; Case vk_end: sendmessage (hwnd, wm_vscroll, sb_bottom, 0); break; case vk_prior: sendmessage (hwnd, wm_vscroll, sb_pageup, 0); break ;...} return 0 ;...
. FAQs
1) Use sendmessage to cut, copy, and paste messages.
Sendmessage (hwnd, wm_copy, 0, 0); sendmessage (hwnd, wm_cut, 0, 0); sendmessage (hwnd, wm_paste, 0, 0 );
2) differences between sendmessage and postmessage
Postmessage puts the message into the message queue and returns immediately. sendmessage is not returned until the message is processed in the window.
3) sendmessage send wm_copydata messages to transmit data between processes
A wm_copydata message is designed to allow a small amount of read-only data to be transmitted between processes. We recommend that you use the sendmessage () function in the SDK documentation. The receiver does not return data before the data is copied, so that the sender cannot delete or modify data.
For example:
STD: String strdata = "VC Knowledge Base vckbase. com "; copydatastruct CDs; CDs. dwdata = 0; CDs. cbdata = strdata. length (); CDs. lpdata = strdata. c_str ();: sendmessage (hwnd, wm_copydata, null, (lparam) & CDs );
(Full text)
|