windows消息机制详解(转载)

消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了。例如,单击鼠标、改变窗口尺寸、按下键盘上的一个键都会使Windows发送一个消息给应用程序。消息本身是作为一个记录传递给应用程序的,这个记录中包含了消息的类型以及其他信息。例如,对于单击鼠标所产生的消息来说,这个记录中包含了单击鼠标时的坐标。这个记录类型叫做TMsg,

它在Windows单元中是这样声明的:
type
TMsg = packed record
hwnd: HWND; / /窗口句柄
message: UINT; / /消息常量标识符
wParam: WPARAM ; // 32位消息的特定附加信息
lParam: LPARAM ; // 32位消息的特定附加信息
time: DWORD; / /消息创建时的时间
pt: TPoint; / /消息创建时的鼠标位置
end;

消息中有什么?
是否觉得一个消息记录中的信息像希腊语一样?如果是这样,那么看一看下面的解释:
hwnd 32位的窗口句柄。窗口可以是任何类型的屏幕对象,因为Win32能够维护大多数可视对象的句柄(窗口、对话框、按钮、编辑框等)。
message 用于区别其他消息的常量值,这些常量可以是Windows单元中预定义的常量,也可以是自定义的常量。
wParam 通常是一个与消息有关的常量值,也可能是窗口或控件的句柄。
lParam 通常是一个指向内存中数据的指针。由于WPARAM、LPARAM和Pointer都是32位的,因此,它们之间可以相互转换。

消息类别
消息和命令有三种主要类别: 
1.Windows 消息 :
主要包含以 WM_ 为前缀的消息,除了 WM_COMMAND。Windows 消息是由窗口和视图处理。这些消息通常有用来决定消息处理方式的参数。
2.控件告知 :
这包含从控件和其它子窗口传递到父窗口的 WM_COMMAND 告知消息。例如,当使用者采取可能会在编辑控件有变更文字的动作,编辑控件传送包含 EN_CHANGE 控件告知程序代码的 WM_COMMAND 消息到父窗口 (Parent)。消息的窗口处理例程以某些适当的方法响应告知消息,例如在控件中撷取文字。 
架构像其它 WM_ 消息一样传送控件告知消息。然而,有一个例外,那就是 BN_CLICKED 控件告知消息是在使用者点选按钮时,由按钮来传送。这个消息特别被当作命令消息来对待,并且像其它的命令一样被传送。 
3.命令消息 :
这包含从使用者接口对象的 WM_COMMAND 告知消息:菜单、工具列按钮和快速键。架构处理命令与其它消息不同,而且可以由更多种对象来处理,如命令目标中所解释的。

Windows 消息和控件告知消息:是由窗口来处理,从 CWnd 类别衍生出类别的对象。包含 CFrameWnd、CMDIFrameWnd、CMDIChildWnd、CView、CDialog 和您自己从这些基底类别 (Base Class) 衍生出的类别。这类的对象封装 HWND,其为一个 Windows 窗口的控制代码。
命令消息:可以由更广泛种类的对象处理,除窗口和视图之外,还有文檔、文件样板和应用程序对象本身。当命令直接影响到一些特定的对象时,让该对象处理命令是对的。例如,在档案菜单的开启命令与应用程序在逻辑上有相关联:当接收到这个命令时,应用程序开启一个指定的文档。所以这个开启命令的处理例程是应用程序类别的一个成员函式。

控件通告消息(Notification Message)由控件发往父窗口,而控件消息(Messages)则由外部发送给控件的。控件的父窗口通过(WM_COMMAND )消息接收控件的通告消息(Notification Message)。

A window receives this message through its WindowProc function.窗口通过WindowProc()函数接收消息

Range Meaning:
0 through WM_USER–1: Messages reserved for use by the system. Message numbers in the first range (0 through WM_USER–1) are defined by the system. Values in this range that are not explicitly defined are reserved for future use by the system.

WM_USER() through 0x7FFF: Integer messages for use by private window classes. Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.

WM_APP(0x8000) through 0xBFFF: Messages available for use by applications. Message numbers in the third range (0x8000 through 0xBFFF) are available for application to use as private messages. Message in this range do not conflict with system messages.

0xC000 through 0xFFFF: String messages for use by applications. Message numbers in the fourth range (0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different sessions.

Greater than 0xFFFF: Reserved by the system for future use. Message numbers in the fifth range (greater than 0xFFFF) are reserved for future use by the system.

Simple notifications are sent as special WM_COMMAND messages, with the notification code (such as BN_CLICKED) and control ID packed into wParam and the control’s handle in lParam.

Remarks:备注,  注意, 注释

消息返回值为Zero(0)(#define FALSE 0),则继续处理;返回Nonzero(非0)(#define TRUE 1),则停止处理。

WM_NULL = H0000;

WM_CREATE = H0001;
应用程序创建一个窗口
The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. The window procedure of the new window receives this message after the window is created, but before the window becomes visible. The message is sent before the CreateWindowEx or CreateWindow function returns. 
WM_CREATE 
lpcs = (LPCREATESTRUCT) lParam; // structure with creation data  
Parameters
lParam 
Value of lParam. Pointer to a CREATESTRUCT structure that contains information about the window being created. The members of CREATESTRUCT are identical to the parameters of the CreateWindowEx function. 
Return Values
If an application processes this message, it should return 0 to continue creation of the window. If the application returns –1, the window is destroyed and the CreateWindowEx or CreateWindow function returns a NULL handle.

WM_DESTROY = H0002;
一个窗口被销毁
The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. 
This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist. 
WM_DESTROY  
Parameters
This message has no parameters. 
Return Values
If an application processes this message, it should return zero. 
Remarks
If the window being destroyed is part of the clipboard viewer chain (set by calling the SetClipboardViewer function), the window must remove itself from the chain by processing the ChangeClipboardChain function before returning from the WM_DESTROY message.

WM_MOVE = H0003;
移动一个窗口
The WM_MOVE message is sent after a window has been moved. 
WM_MOVE 
xPos = (int)(short) LOWORD(lParam);    // horizontal position 
yPos = (int)(short) HIWORD(lParam);    // vertical position  
Parameters
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the upper-left corner of the client area of the window. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the upper-left corner of the client area of the window. 
Return Values
If an application processes this message, it should return zero. 
Remarks
The xPos and yPos parameters are given in screen coordinates for overlapped and pop-up windows and in parent-client coordinates for child windows. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_SIZE = H0005;
改变一个窗口的大小
The WM_SIZE message is sent to a window after its size has changed. 
WM_SIZE 
fwSizeType = wParam;      // resizing flag 
nWidth = LOWORD(lParam);  // width of client area 
nHeight = HIWORD(lParam); // height of client area  
Parameters
fwSizeType 
Value of wParam. Specifies the type of resizing requested. This parameter can be one of the following values: Value Meaning 
SIZE_MAXHIDE Message is sent to all pop-up windows when some other window is maximized. 
SIZE_MAXIMIZED The window has been maximized. 
SIZE_MAXSHOW Message is sent to all pop-up windows when some other window has been restored to its former size. 
SIZE_MINIMIZED The window has been minimized. 
SIZE_RESTORED The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies. 
nWidth 
Value of the low-order word of lParam. Specifies the new width of the client area. 
nHeight 
Value of the high-order word of lParam. Specifies the new height of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
If the SetScrollPos or MoveWindow function is called for a child window as a result of the WM_SIZE message, the bRedraw parameter should be nonzero to cause the window to be repainted. 
Although the width and height of a window are 32-bit values, the nWidth and nHeight parameters of the WM_SIZE message contain only the low-order 16 bits.

WM_ACTIVATE = H0006;
一个窗口被激活或失去激活状态;
The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately. 
WM_ACTIVATE 
fActive = LOWORD(wParam);           // activation flag 
fMinimized = (BOOL) HIWORD(wParam); // minimized flag 
hwndPrevious = (HWND) lParam;       // window handle  
Parameters
fActive 
Value of the low-order word of wParam. Specifies whether the window is being activated or deactivated. This parameter can be one of the following values. Value Meaning 
WA_ACTIVE Activated by some method other than a mouse click (for example, by a call to the SetActiveWindow function or by use of the keyboard interface to select the window). 
WA_CLICKACTIVE Activated by a mouse click. 
WA_INACTIVE Deactivated. 
fMinimized 
Value of the high-order word of wParam. Specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized. 
hwndPrevious 
Value of lParam. Handle to the window being activated or deactivated, depending on the value of the fActive parameter. If the value of fActive is WA_INACTIVE, hwndPrevious is the handle to the window being activated. If the value of fActive is WA_ACTIVE or WA_CLICKACTIVE, hwndPrevious is the handle to the window being deactivated. This handle can be NULL. 
Return Values
If an application processes this message, it should return zero. 
Default Action
If the window is being activated and is not minimized, the DefWindowProc function sets the keyboard focus to the window. 
Remarks
If the window is activated by a mouse click, it also receives a WM_MOUSEACTIVATE message.

WM_SETFOCUS = H0007;
获得焦点后
The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. 
WM_SETFOCUS 
hwndLoseFocus = (HWND) wParam; // handle to window losing focus  
Parameters
hwndLoseFocus 
Value of wParam. Handle to the window that has lost the keyboard focus (may be NULL). 
Return Values
An application should return zero if it processes this message. 
Remarks
To display a caret, an application should call the appropriate caret functions when it receives the WM_SETFOCUS message.

WM_KILLFOCUS = H0008;
失去焦点
The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. 
WM_KILLFOCUS 
hwndGetFocus = (HWND) wParam; // handle to window receiving focus  
Parameters
hwndGetFocus 
Value of wParam. Handle to the window that receives the keyboard focus (may be NULL). 
Return Values
An application should return zero if it processes this message. 
Remarks
If an application is displaying a caret, the caret should be destroyed at this point.

WM_ENABLE = H000A;
改变enable状态
The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. 
WM_ENABLE 
fEnabled = (BOOL) wParam;   // enabled/disabled flag 
Parameters
fEnabled 
Value of wParam. Specifies whether the window has been enabled or disabled. This parameter is TRUE if the window has been enabled or FALSE if the window has been disabled. 
Return Values
If an application processes this message, it should return zero.

WM_SETREDRAW = H000B;
设置窗口是否能重画
An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn. 
WM_SETREDRAW 
wParam = (WPARAM) fRedraw;  // state of redraw flag 
lParam = 0;                 // not used; must be zero  
Parameters
fRedraw 
Value of wParam. Specifies the state of the redraw flag. If this parameter is TRUE, the redraw flag is set. If the parameter is FALSE, the flag is cleared. 
Return Values
An application returns zero if it processes this message. 
Remarks
This message sets or clears the redraw flag. If the redraw flag is cleared, the content of the given window is not updated after each change, and the window is not repainted until the redraw flag is set. For example, an application that must add several items to a list box can clear the redraw flag, add the items, and then set the redraw flag. Finally, the application can call the InvalidateRect function to cause the list box to be repainted.

WM_SETTEXT = H000C;
应用程序发送此消息来设置一个窗口的文本
An application sends a WM_SETTEXT message to set the text of a window. 
WM_SETTEXT 
wParam = 0;                     // not used; must be zero 
lParam = (LPARAM)(LPCTSTR)lpsz; // address of window-text string  
Parameters
lpsz 
Value of lParam. Pointer to a null-terminated string that is the window text. 
Return Values
The return value is TRUE if the text is set. It is FALSE (for an edit control), LB_ERRSPACE (for a list box), or CB_ERRSPACE (for a combo box) if insufficient space is available to set the text in the edit control. It is CB_ERR if this message is sent to a combo box without an edit control. 
Default Action
The DefWindowProc function sets and displays the window text. 
Remarks
For an edit control, the text is the contents of the edit control. For a combo box, the text is the contents of the edit-control portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. 
This message does not change the current selection in the list box of a combo box. An application should use the CB_SELECTSTRING message to select the item in a list box that matches the text in the edit control.

WM_GETTEXT = H000D;
应用程序发送此消息来复制对应窗口的文本到缓冲区
An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller. 
WM_GETTEXT 
wParam = (WPARAM) cchTextMax;   // number of characters to copy 
lParam = (LPARAM) lpszText;     // address of buffer for text 
 Parameters
cchTextMax 
Value of wParam. Specifies the maximum number of characters to be copied, including the terminating null character. 
lpszText 
Value of lParam. Pointer to the buffer that is to receive the text. 
Return Values
The return value is the number of characters copied. 
Default Action
The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied. 
Remarks
For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To copy the text of an item in a list box, an application can use the LB_GETTEXT message. 
When the WM_GETTEXT message is sent to a static control with the SS_ICON style, a handle to the icon will be returned in the first four bytes of the buffer pointed to by lpszText. This is true only if the WM_SETTEXT message has been used to set the icon. 
In a rich edit control, if the text to be copied exceeds 64K, use either the message EM_STREAMOUT or EM_GETSELTEXT.

WM_GETTEXTLENGTH = H000E;
得到与一个窗口有关的文本的长度(不包含空字符)
An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window. The length does not include the terminating null character. 
WM_GETTEXTLENGTH 
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero  
Parameters
This message has no parameters. 
Return Values
The return value is the length, in characters, of the text. 
Default Action
The DefWindowProc function returns the length, in characters, of the text. Under certain conditions, this value may actually be greater than the length of the text. For more information, see the following Remarks section.
Remarks
For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To determine the length of an item in a list box, an application can use the LB_GETTEXTLEN message. 
Under certain conditions, the DefWindowProc function returns a value that is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the system allowing for the possible existence of DBCS characters within the text. The return value, however, will always be at least as large as the actual length of the text; you can thus always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode. 
To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.

WM_PAINT = H000F;
要求一个窗口重画自己
An application sends the WM_PAINT message when the system or another application makes a request to paint a portion of an application‘s window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by theDispatchMessage function when the application obtains a WM_PAINT message by using theGetMessage orPeekMessage function. 
WM_PAINT 
hdc = (HDC) wParam; // the device context to draw in
 Parameters
hdc 
Handle to the device context to draw in. If this parameter is NULL, use the default device context. This parameter is used by some common controls to enable drawing in a device context other than the default device context. Other windows can safely ignore this parameter. 
Return Values
An application returns zero if it processes this message. 
Remarks
The DefWindowProc function validates the update region. The function may also send the WM_NCPAINT message to the window procedure if the window frame must be painted and send theWM_ERASEBKGND message if the window background must be erased. 
The system sends this message when there are no other messages in the application‘s message queue. DispatchMessage determines where to send the message; GetMessage determines which message to dispatch. GetMessage returns the WM_PAINT message when there are no other messages in the application‘s message queue, and DispatchMessage sends the message to the appropriate window procedure. 
A window may receive internal paint messages as a result of calling RedrawWindow with the RDW_INTERNALPAINT flag set. In this case, the window may not have an update region. An application should call the GetUpdateRect function to determine whether the window has an update region. If GetUpdateRect returns zero, the application should not call the BeginPaint and EndPaint functions. 
An application must check for any necessary internal painting by looking at its internal data structures for each WM_PAINT message, because a WM_PAINT message may have been caused by both a non-NULL update region and a call to RedrawWindow with the RDW_INTERNALPAINT flag set. 
The system sends an internal WM_PAINT message only once. After an internal WM_PAINT message is returned from GetMessage or PeekMessage or is sent to a window by UpdateWindow, the system does not post or send further WM_PAINT messages until the window is invalidated or until RedrawWindow is called again with the RDW_INTERNALPAINT flag set. 
For some common controls, the default WM_PAINT message processing checks the wParam parameter. If wParam is non-NULL, the control assumes that the value is an HDC and paints using that device context.

WM_CLOSE = H0010;
当一个窗口或应用程序要关闭时发送一个信号
The WM_CLOSE message is sent as a signal that a window or an application should terminate. 
WM_CLOSE  
Parameters
This message has no parameters. 
Return Values
If an application processes this message, it should return zero. 
Default Action
The DefWindowProc function calls the DestroyWindow function to destroy the window. 
Remarks
An application can prompt the user for confirmation, prior to destroying a window, by processing the WM_CLOSE message and calling the DestroyWindow function only if the user confirms the choice.

WM_QUERYENDSESSION = H0011;
当用户选择结束对话框或程序自己调用ExitWindows函数
The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls the ExitWindows function. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero. 
After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message. 
WM_QUERYENDSESSION 
nSource = (UINT) wParam;    // source of end-session request 
fLogOff = lParam            // logoff flag 
 Parameters
nSource 
Reserved for future use. 
fLogOff 
Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF. 
Return Values
If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE. 
Remarks
By default, the DefWindowProc function returns TRUE for this message. 
Windows NT: When an application returns TRUE for this message, it receives the WM_ENDSESSION message and it is terminated, regardless of how the other applications respond to the WM_QUERYENDSESSION message. 
Windows 95: After all applications return TRUE for this message, they receive the WM_ENDSESSION and they are terminated.

WM_QUIT = H0012;
用来结束程序运行或当程序调用postquitmessage函数 
The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero. 
WM_QUIT 
nExitCode = (int) wParam;   // exit code 
 Parameters
nExitCode 
Value of wParam. Specifies the exit code given in the PostQuitMessage function. 
Return Values
This message does not have a return value, because it causes the message loop to terminate before the message is sent to the application‘s window procedure.

WM_QUERYOPEN = H0013;
当用户窗口恢复以前的大小位置时,把此消息发送给某个图标
The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position. 
WM_QUERYOPEN  
Parameters
This message has no parameters. 
Return Values
If the icon can be opened, an application that processes this message should return TRUE; otherwise, it should return FALSE to prevent the icon from being opened. 
Default Action
The DefWindowProc function returns TRUE. 
Remarks
While processing this message, the application should not perform any action that would cause an activation or focus change (for example, creating a dialog box).

WM_ERASEBKGND = H0014;
当窗口背景必须被擦除时(例在窗口改变大小时)
An application sends the WM_ERASEBKGND message when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting. 
WM_ERASEBKGND 
hdc = (HDC) wParam; // handle to device context  
Parameters
hdc 
Value of wParam. Handle to the device context. 
Return Values
An application should return nonzero if it erases the background; otherwise, it should return zero. 
Remarks
The DefWindowProc function erases the background by using the class background brush specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background. 
An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)

WM_SYSCOLORCHANGE = H0015;
当系统颜色改变时,发送此消息给所有顶级窗口
The WM_SYSCOLORCHANGE message is sent to all top-level windows when a change is made to a system color setting. 
WM_SYSCOLORCHANGE  
Parameters
This message has no parameters. 
Remarks
The system sends a WM_PAINT message to any window that is affected by a system color change. 
Applications that have brushes using the existing system colors should delete those brushes and recreate them using the new system colors. 
Top level windows that use common controls must forward the WM_SYSCOLORCHANGE message to the controls; otherwise, the controls will not be notified of the color change. This ensures that the colors used by your common controls are consistent with those used by other user interface objects. For example, a toolbar control uses the "3D Objects" color to draw its buttons. If the user changes the 3D Objects color but the WM_SYSCOLORCHANGE message is not forwarded to the toolbar, the toolbar buttons will remain in their original color while the color of other buttons in the system changes.

WM_ENDSESSION = H0016;
当系统进程发出WM_QUERYENDSESSION消息后,此消息发送给应用程序,通知它对话是否结束
The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending. 
WM_ENDSESSION 
fEndSession = (BOOL) wParam;     // end-session flag 
fLogOff =  lParam                // logoff flag  
Parameters
fEndSession 
Value of wParam. Specifies whether the session is being ended. If the session is being ended, this parameter is TRUE; otherwise, it is FALSE. 
fLogOff 
Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF. 
Return Values
If an application processes this message, it should return zero. 
Remarks
If the fEndSession parameter is TRUE, the session can end any time after all applications have returned from processing this message. Therefore, an application should perform all tasks required for termination before returning from this message. 
The application need not call the DestroyWindow or PostQuitMessage function when the session is ending.

WM_SYSTEMERROR = H0017;

WM_SHOWWINDOW = H0018;
当隐藏或显示窗口是发送此消息给这个窗口
The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. 
WM_SHOWWINDOW 
fShow = (BOOL) wParam;      // show/hide flag 
fnStatus = (int) lParam;    // status flag  
Parameters
fShow 
Value of wParam. Specifies whether a window is being shown. It is TRUE if the window is being shown or FALSE if the window is being hidden. 
fnStatus 
Value of lParam. Specifies the status of the window being shown. The fnStatus parameter is zero if the message is sent because of a call to the ShowWindow function; otherwise, fnStatus is one of the following values: Value Meaning 
SW_OTHERUNZOOM The window is being uncovered because a maximize window was restored or minimized. 
SW_OTHERZOOM The window is being covered by another window that has been maximized. 
SW_PARENTCLOSING The window‘s owner window is being minimized. 
SW_PARENTOPENING The window‘s owner window is being restored. 
Return Values
If an application processes this message, it should return zero. 
Default Action
The DefWindowProc function hides or shows the window, as specified by the message. 
Remarks
If a window has the WS_VISIBLE style when it is created, the window receives this message after it is created, but before it is displayed. A window also receives this message when its visibility state is changed by the ShowWindow or ShowOwnedPopups function. 
The WM_SHOWWINDOW message is not sent under the following circumstances: 
When a top-level, overlapped window is created with the WS_MAXIMIZE or WS_MINIMIZE style. 
When the SW_SHOWNORMAL flag is specified in the call to the ShowWindow function.

WM_ACTIVATEAPP = H001C;
发此消息给应用程序哪个窗口是激活的,哪个是非激活的;
The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated. 
WM_ACTIVATEAPP 
fActive = (BOOL) wParam;        // activation flag 
dwThreadID = (DWORD) lParam:    // thread identifier  
Parameters
fActive 
Value of wParam. Specifies whether the window is being activated or deactivated. This parameter is TRUE if the window is being activated; it is FALSE if the window is being deactivated. 
dwThreadID 
Value of lParam. Specifies a thread identifier. If the fActive parameter is TRUE, dwThreadID is the identifier of the thread that owns the window being deactivated. If fActive is FALSE, dwThreadID is the identifier of the thread that owns the window being activated. 
Return Values
If an application processes this message, it should return zero.

WM_FONTCHANGE = H001D;
当系统的字体资源库变化时发送此消息给所有顶级窗口
An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources. 
WM_FONTCHANGE 
wParam = 0; // not used, must be zero 
lParam = 0; // not used, must be zero  
Parameters
This message has no parameters. 
Remarks
An application that adds or removes fonts from the system (for example, by using the AddFontResource or RemoveFontResource function) should send this message to all top-level windows. 
To send the WM_FONTCHANGE message to all top-level windows, an application can call the SendMessage function with the hwnd parameter set to HWND_BROADCAST.

WM_TIMECHANGE = H001E;
当系统的时间变化时发送此消息给所有顶级窗口
Windows NT 5.0 and later: An application should not broadcast this message, because the system will broadcast this message when the application changes the system time. 
Windows NT 4.0 and earlier: An application should send the WM_TIMECHANGE message to all top-level windows after changing the system time. 
Windows 95: An application should send the WM_TIMECHANGE message to all top-level windows after changing the system time. 
WM_TIMECHANGE 
wParam = 0; // not used, must be zero 
lParam = 0; // not used, must be zero  
Parameters
This message has no parameters. 
Return Values
An application should return zero if it processes this message. 
Remarks
To send the WM_TIMECHANGE message to all top-level windows, an application can use the SendMessage function with the hwnd parameter set to HWND_TOPMOST.

WM_CANCELMODE = H001F;
发送此消息来取消某种正在进行的摸态(操作)
The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window. 
WM_CANCELMODE  
Parameters
This message has no parameters. 
Return Values
If an application processes this message, it should return zero. 
Default Action
The DefWindowProc function cancels internal processing of standard scroll bar input, cancels internal menu processing, and releases the mouse capture.

WM_SETCURSOR = H0020;
如果鼠标引起光标在某个窗口中移动且鼠标输入没有被捕获时,就发消息给某个窗口
The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured. 
WM_SETCURSOR 
hwnd = (HWND) wParam;       // handle to window with cursor 
nHittest = LOWORD(lParam);  // hit-test code 
wMouseMsg = HIWORD(lParam); // mouse-message identifier  
Parameters
hwnd 
Value of wParam. Handle to the window that contains the cursor. 
nHittest 
Value of the low-order word of lParam. Specifies the hit-test code. 
wMouseMsg 
Value of the high-order word of lParam. Specifies the identifier of the mouse message. 
Default Action
The DefWindowProc function passes the WM_SETCURSOR message to a parent window before processing. If the parent window returns TRUE, further processing is halted. Passing the message to a window‘s parent window gives the parent window control over the cursor‘s setting in a child window. The DefWindowProc function also uses this message to set the cursor to an arrow if it is not in the client area, or to the registered class cursor if it is in the client area. If the low-order word of the lParam parameter is HTERROR and the high-order word of lParam specifies that one of the mouse buttons is pressed, DefWindowProc calls the MessageBeep function. 
Remarks
The high-order word of lParam is zero when the window enters menu mode.

WM_MOUSEACTIVATE = H0021;
当光标在某个非激活的窗口中而用户正按着鼠标的某个键发送此消息给当前窗口
The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function. 
WM_MOUSEACTIVATE 
hwndTopLevel = (HWND) wParam;       // handle of top-level parent 
nHittest = (INT) LOWORD(lParam);    // hit-test value 
uMsg =    (UINT) HIWORD(lParam);    // mouse message  
Parameters
hwndTopLevel 
Value of wParam. Handle to the top-level parent window of the window being activated. 
nHittest 
Value of the low-order word of lParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
uMsg 
Value of the high-order word of lParam. Specifies the identifier of the mouse message generated when the user pressed a mouse button. The mouse message is either discarded or posted to the window, depending on the return value. 
Return Values
The return value specifies whether the window should be activated and whether the identifier of the mouse message should be discarded. It must be one of the following values: 
Value Meaning 
MA_ACTIVATE Activates the window, and does not discard the mouse message. 
MA_ACTIVATEANDEAT Activates the window, and discards the mouse message. 
MA_NOACTIVATE Does not activate the window, and does not discard the mouse message. 
MA_NOACTIVATEANDEAT Does not activate the window, but discards the mouse message. 
Default Action
The DefWindowProc function passes the message to a child window‘s parent window before any processing occurs. The parent window determines whether to activate the child window. If it activates the child window, the parent window should return MA_NOACTIVATE or MA_NOACTIVATEANDEAT to prevent the system from processing the message further.

WM_CHILDACTIVATE = H0022;
发送此消息给MDI子窗口当用户点击此窗口的标题栏,或当窗口被激活,移动,改变大小
The WM_CHILDACTIVATE message is sent to a multiple document interface (MDI) child window when the user clicks the window‘s title bar or when the window is activated, moved, or sized. 
WM_CHILDACTIVATE  
Parameters
This message has no parameters. 
Return Values
If an application processes this message, it should return zero.

WM_QUEUESYNC = H0023;
消息由基于计算机的训练程序发送,通过WH_JOURNALPALYBACK的hook程序分离出用户输入消息
The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK hook procedure. 
WM_QUEUESYNC 
wParam = 0; // not used, must be zero 
lParam = 0; // not used, must be zero  
Parameters
This message has no parameters. 
Return Values
A CBT application should return zero if it processes this message. 
Remarks
Whenever a CBT application uses the WH_JOURNALPLAYBACK hook procedure, the first and last messages are WM_QUEUESYNC. This allows the CBT application to intercept and examine user-initiated messages without doing so for events that it sends. 
If an application specifies a NULL window handle, the message is posted to the message queue of the active window.

WM_GETMINMAXINFO = H0024;
消息发送给窗口当它将要改变大小或位置;
The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window‘s default maximized size and position, or its default minimum or maximum tracking size. 
WM_GETMINMAXINFO 
lpmmi = (LPMINMAXINFO) lParam; // address of structure  
Parameters
lpmmi 
Value of lParam. Pointer to a MINMAXINFO structure that contains the default maximized position and dimensions, and the default minimum and maximum tracking sizes. An application can override the defaults by setting the members of this structure. 
Return Values
If an application processes this message, it should return zero. 
Remarks
The maximum tracking size is the largest window size that can be produced by using the borders to size the window. The minimum tracking size is the smallest window size that can be produced by using the borders to size the window.

WM_PAINTICON = H0026;
发送给最小化窗口当它图标将要被重画
The WM_PAINTICON message is sent to a minimized window when the icon is to be painted but only if the application is written for 16-bit Windows. A window receives this message only if a class icon is defined for the window; otherwise,WM_PAINT is sent instead. 
WM_PAINTICON  
Parameters
This message has no parameters. 
Return Values
An application should return zero if it processes this message. 
Remarks
The DefWindowProc function draws the class icon. For compatibility with 16-bit Windows, wParam is TRUE. However, this value has no significance.

WM_ICONERASEBKGND = H0027;
消息发送给某个最小化窗口,仅当它在画图标前它的背景必须被重画
The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. 
WM_ICONERASEBKGND 
hdc = (HDC) wParam; // handle to device context  
Parameters
hdc 
Value of wParam. Handle to the device context of the icon. 
Return Values
An application should return nonzero if it processes this message. 
Remarks
The DefWindowProc function fills the icon background with the class background brush of the parent window.

WM_NEXTDLGCTL = H0028;
发送此消息给一个对话框程序去更改焦点位置
The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box. 
WM_NEXTDLGCTL 
wCtlFocus = wParam;              // identifies control for focus 
fHandle = (BOOL) LOWORD(lParam); // wParam handle flag  
Parameters
wCtlFocus 
Value of wParam. If the fHandle parameter is TRUE, the wCtlFocus parameter identifies the control that receives the focus. If fHandle is FALSE, wCtlFocus is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus. If wCtlFocus is zero, the next control receives the focus; otherwise, the previous control with the WS_TABSTOP style receives the focus. 
fHandle 
Value of lParam. Contains a flag that indicates how the system uses the wCtlFocus parameter. If the fHandle parameter is TRUE, wCtlFocus is a handle associated with the control that receives the focus; otherwise, wCtlFocus is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus. 
Return Values
An application should return zero if it processes this message. 
Remarks
The effect of this message differs from that of the SetFocus function because WM_NEXTDLGCTL modifies the border around the control. 
Do not use the SendMessage function to send a WM_NEXTDLGCTL message if your application will concurrently process other messages that set the focus. Use the PostMessage function instead.

WM_SPOOLERSTATUS = H002A;
每当打印管理列队增加或减少一条作业时发出此消息 
The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue. 
WM_SPOOLERSTATUS 
fwJobStatus = wParam;       // job-status flag 
cJobsLeft = LOWORD(lParam); // number of jobs remaining  
Parameters
fwJobStatus 
Value of wParam. Specifies the PR_JOBSTATUS flag. 
cJobsLeft 
Value of the low-order word of lParam. Specifies the number of jobs remaining in the Print Manager queue. 
Return Values
An application should return zero if it processes this message. 
Remarks
This message is for informational purposes only.

WM_DRAWITEM = H002B;
当button,combobox,listbox,menu的可视外观改变时发送此消息给这些空件的所有者
The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed. 
WM_DRAWITEM 
idCtl = (UINT) wParam;             // control identifier 
lpdis = (LPDRAWITEMSTRUCT) lParam; // item-drawing information  
Parameters
idCtl 
Value of wParam. Specifies the identifier of the control that sent the WM_DRAWITEM message. If the message was sent by a menu, this parameter is zero. 
lpdis 
Value of lParam. Pointer to a DRAWITEMSTRUCT structure containing information about the item to be drawn and the type of drawing required. 
Return Values
If an application processes this message, it should return TRUE. 
Default Action
The DefWindowProc function draws the focus rectangle for an owner-drawn list box item. 
Remarks
The itemAction member of the DRAWITEMSTRUCT structure specifies the drawing operation that an application should perform. 
Before returning from processing this message, an application should ensure that the device context identified by the hDC member of the DRAWITEMSTRUCT structure is in the default state.

WM_MEASUREITEM = H002C;
当button, combo box, list box, list view control, or menu item 被创建时发送此消息给控件的所有者
The WM_MEASUREITEM message is sent to the owner window of an owner-drawn button, combo box, list box, list view control, or menu item when the control or menu is created. 
WM_MEASUREITEM 
idCtl = (UINT) wParam;                // control identifier 
lpmis = (LPMEASUREITEMSTRUCT) lParam; // item-size information  
Parameters
idCtl 
Value of wParam. Contains the value of the CtlID member of the MEASUREITEMSTRUCT structure pointed to by the lpmis parameter. This value identifies the control that sent the WM_MEASUREITEM message. 
If the value is zero, the message was sent by a menu. If the value is nonzero, the message was sent by a combo box or by a list box. If the value is nonzero, and the value of the itemID member of the MEASUREITEMSTRUCT pointed to by lpmis is (UINT) –1, the message was sent by a combo edit field. 
lpmis 
Value of lParam. Pointer to a MEASUREITEMSTRUCT structure that contains the dimensions of the owner-drawn control or menu item. 
Return Values
If an application processes this message, it should return TRUE. 
Remarks
When the owner window receives the WM_MEASUREITEM message, the owner fills in the MEASUREITEMSTRUCT structure pointed to by the lParam parameter of the message and returns; this informs the system of the dimensions of the control. If a list box or combo box is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style, this message is sent to the owner for each item in the control; otherwise, this message is sent once. 
The system sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending the WM_INITDIALOG message. As a result, when the owner receives this message, the system has not yet determined the height and width of the font used in the control; function calls and calculations requiring these values should occur in the main function of the application or library.

WM_DELETEITEM = H002D;
当the list box 或 combo box 被销毁或 当 某些项被删除通过LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT 消息
The WM_DELETEITEM message is sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.
WM_DELETEITEM 
idCtl = wParam;                      // control identifier 
lpdis = (LPDELETEITEMSTRUCT) lParam; // structure with item information  
Parameters
idCtl 
Value of wParam. Specifies the identifier of the control that sent the WM_DELETEITEM message. 
lpdis 
Value of lParam. Pointer to a DELETEITEMSTRUCT structure that contains information about the item deleted from a list box. 
Return Values
An application should return TRUE if it processes this message.

WM_VKEYTOITEM = H002E;
消息有一个LBS_WANTKEYBOARDINPUT风格的发出给它的所有者来响应WM_KEYDOWN消息 
The WM_VKEYTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message. 
WM_VKEYTOITEM 
vkey = LOWORD(wParam);      // virtual-key code 
nCaretPos = HIWORD(wParam); // caret position 
hwndLB = lParam;            // handle to list box  
Parameters
vkey 
Value of the low-order word of wParam. Specifies the virtual-key code of the key the user pressed. 
nCaretPos 
Value of the high-order word of wParam. Specifies the current position of the caret. 
hwndLB 
Value of lParam. Handle to the list box. 
Return Values
The return value specifies the action that the application performed in response to the message. A return value of –2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of –1 indicates that the list box should perform the default action in response to the keystroke. A return value of 0 or greater specifies the index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the given item. 
Default Action
The DefWindowProc function returns –1. 
Remarks
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_CHARTOITEM = H002F;
消息由一个LBS_WANTKEYBOARDINPUT风格的列表框发送给他的所有者来响应WM_CHAR消息 
The WM_CHARTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message. 
WM_CHARTOITEM 
nKey = LOWORD(wParam);          // key value 
nCaretPos = HIWORD(wParam);     // caret position 
hwndListBox = (HWND) lParam;    // handle to list box  
Parameters
nKey 
Value of the low-order word of wParam. Specifies the value of the key the user pressed. 
nCaretPos 
Value of the high-order word of wParam. Specifies the current position of the caret. 
hwndListBox 
Value of lParam. Handle to the list box. 
Return Values
The return value specifies the action that the application performed in response to the message. A return value of –1 or –2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of 0 or greater specifies the zero-based index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the given item. 
Default Action
The DefWindowProc function returns –1. 
Remarks
Only owner-drawn list boxes that do not have the LBS_HASSTRINGS style can receive this message. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_SETFONT = H0030;
当绘制文本时程序发送此消息得到控件要用的颜色 
An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text. 
WM_SETFONT 
wParam = (WPARAM) hfont;            // handle of font 
lParam = MAKELPARAM(fRedraw, 0);    // redraw flag  
Parameters
hfont 
Value of wParam. Handle to the font. If this parameter is NULL, the control uses the default system font to draw text. 
fRedraw 
Value of lParam. Specifies whether the control should be redrawn immediately upon setting the font. Setting the fRedraw parameter to TRUE causes the control to redraw itself. 
Return Values
This message does not return a value. 
Remarks
The WM_SETFONT message applies to all controls, not just those in dialog boxes. 
The best time for the owner of a dialog box control to set the font of the control is when it receives the WM_INITDIALOG message. The application should call theDeleteObject function to delete the font when it is no longer needed; for example, after it destroys the control. 
The size of the control does not change as a result of receiving this message. To avoid clipping text that does not fit within the boundaries of the control, the application should correct the size of the control window before it sets the font. 
When a dialog box uses the DS_SETFONT style to set the text in its controls, the system sends the WM_SETFONT message to the dialog box procedure before it creates the controls. An application can create a dialog box that contains the DS_SETFONT style by calling any of the following functions: 
CreateDialogIndirect 、CreateDialogIndirectParam 、DialogBoxIndirect 、DialogBoxIndirectParam

WM_GETFONT = H0031;
应用程序发送此消息得到当前控件绘制文本的字体
An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text. 
WM_GETFONT 
wParam = 0; // not used, must be zero 
lParam = 0; // not used, must be zero  
Parameters
This message has no parameters. 
Return Values
The return value is a handle to the font used by the control, or NULL if the control is using the system font.

WM_SETHOTKEY = H0032;
应用程序发送此消息让一个窗口与一个热键相关连
An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window. 
WM_SETHOTKEY 
wParam = (WPARAM) MAKEWORD(vkey, modifiers)   // virtual-key code and modifiers of hot key 
lParam = 0;                                   // not used; must be zero  
Parameters
vkey 
Value of wParam. Specifies the virtual-key code and modifiers of the hot key to associate with the window. The virtual-key code is in the low byte of the parameter and the modifier flags are in the high byte. Setting this parameter to NULL removes the hot key associated with a window. The modifier byte can be a combination of the following flags. Value Meaning 
HOTKEYF_ALT ALT key 
HOTKEYF_CONTROL CTRL key 
HOTKEYF_EXT Extended key 
HOTKEYF_SHIFT SHIFT key 
Return Values
The return value is one of the following: 
Value Meaning 
–1 The function is unsuccessful — the hot key is invalid. 
..0 The function is unsuccessful — the window is invalid. 
..1 The function is successful, and no other window has the same hot key. 
..2 The function is successful, but another window already has the same hot key. 
Remarks
A hot key cannot be associated with a child window. 
VK_ESCAPE, VK_SPACE, and VK_TAB are invalid hot keys. 
When the user presses the hot key, the system generates a WM_SYSCOMMAND message with wParam equal to SC_HOTKEY and lParam equal to the window‘s handle. If this message is passed on to DefWindowProc, the system will bring the window‘s last active popup (if it exists) or the window itself (if there is no popup window) to the foreground.
A window can only have one hot key. If the window already has a hot key associated with it, the new hot key replaces the old one. If more than one window has the same hot key, the window that is activated by the hot key is random. 
These hot keys are unrelated to the hot keys set by RegisterHotKey.

WM_GETHOTKEY = H0033;
应用程序发送此消息来判断热键与某个窗口是否有关联
An application sends a WM_GETHOTKEY message to determine the hot key associated with a window. 
WM_GETHOTKEY 
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero  
Parameters
This message has no parameters. 
Return Values
The return value is the virtual-key code and modifiers for the hot key, or NULL if no hot key is associated with the window. The virtual-key code is in the low byte of the return value and the modifiers are in the high byte. The modifiers can be a combination of the following flags.
Value Meaning 
HOTKEYF_ALT ALT key 
HOTKEYF_CONTROL CTRL key 
HOTKEYF_EXT Extended key 
HOTKEYF_SHIFT SHIFT key 
Remarks
These hot keys are unrelated to the hot keys set by the RegisterHotKey function.

WM_QUERYDRAGICON = H0037;
消息发送给最小化窗口,当此窗口将要被拖放而它的类中没有定义图标,应用程序能返回一个图标或光标的句柄,当用户拖放图标时系统显示这个图标或光标
The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon. 
WM_QUERYDRAGICON  
Parameters
This message has no parameters. 
Return Values
An application should return a handle to a cursor or icon that the system is to display while the user drags the icon. The cursor or icon must be compatible with the display driver‘s resolution. If the application returns NULL, the system displays the default cursor. 
Default Action
The DefWindowProc function returns a handle to the default cursor. 
Remarks
When the user drags the icon of a window without a class icon, the system replaces the icon with a default cursor. If the application requires a different cursor to be displayed during dragging, it must return a handle to the cursor or icon compatible with the display driver‘s resolution. If an application returns a handle to a color cursor or icon, the system converts the cursor or icon to black and white. The application can call the LoadCursor or LoadIcon function to load a cursor or icon from the resources in its executable (.EXE) file and to retrieve this handle. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_COMPAREITEM = H0039;
发送此消息来判定combobox或listbox新增加的项的相对位置
The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style. 
WM_COMPAREITEM 
idCtl = wParam;                       // control identifier 
lpcis = (LPCOMPAREITEMSTRUCT) lParam; // structure with items  
Parameters
idCtl 
Value of wParam. Specifies the identifier of the control that sent the WM_COMPAREITEM message. 
lpcis 
Value of lParam. Pointer to a COMPAREITEMSTRUCT structure that contains the identifiers and application-supplied data for two items in the combo or list box. 
Return Values
The return value indicates the relative position of the two items. It may be any of the following: 
Value Meaning 
–1 Item 1 precedes item 2 in the sorted order. 
0 Items 1 and 2 are equivalent in the sorted order. 
1 Item 1 follows item 2 in the sorted order. 
Remarks
When the owner of an owner-drawn combo box or list box receives this message, the owner returns a value indicating which of the items specified by the COMPAREITEMSTRUCT structure will appear before the other. Typically, the system sends this message several times until it determines the exact position for the new item. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_GETOBJECT = H003D;
The oleacc.dll dynamic link library sends this message to an Active Accessibility server application to retrieve information about an accessible object it contains. 
wParam = (WPARAM)(DWORD) dwFlags;
lParam = (LPARAM)(DWORD) dwObjId; 
Parameters
dwFlags 
Flag values providing additional information about the message. This value is passed to the LresultFromObject function, as the wParam parameter. 
dwObjId 
Object identifier. This value can be one of the object identifier constants or a custom object identifier. 
Return Values
Returns a value specifying the object‘s reference, a request for a standard object, or a COM error code otherwise. To return an object reference, use the LresultFromObject function. To request a standard accessible object, return zero. To fail the message, return a COM error code.

WM_COMPACTING = H0041;
显示内存已经很少了
The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low. 
WM_COMPACTING 
wCompactRatio = wParam; // compacting ratio  
Parameters
wCompactRatio 
Value of wParam. Specifies the ratio of central processing unit (CPU) time currently spent by the system compacting memory to CPU time currently spent by the system performing other operations. For example, 0x8000 represents 50 percent of CPU time spent compacting memory. 
Return Values
If an application processes this message, it should return zero. 
Remarks
When an application receives this message, it should free as much memory as possible, taking into account the current level of activity of the application and the total number of applications running on the system.

WM_WINDOWPOSCHANGING = H0046;
发送此消息给那个窗口的大小和位置将要被改变时,来调用setwindowpos函数或其它窗口管理函数
The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function. 
WM_WINDOWPOSCHANGING 
lpwp = (LPWINDOWPOS) lParam; // points to size and position data  
Parameters
lpwp 
Value of lParam. Pointer to a WINDOWPOS structure that contains information about the window‘s new size and position. 
Return Values
If an application processes this message, it should return zero. 
Default Action
For a window with the WS_OVERLAPPED or WS_THICKFRAME style, the DefWindowProc function sends the WM_GETMINMAXINFO message to the window. This is done to validate the new size and position of the window and to enforce the CS_BYTEALIGNCLIENT and CS_BYTEALIGNWINDOW client styles. By not passing the WM_WINDOWPOSCHANGING message to the DefWindowProc function, an application can override these defaults. 
Remarks
While this message is being processed, modifying any of the values in WINDOWPOS affects the window‘s new size, position, or place in the Z order. An application can prevent changes to the window by setting or clearing the appropriate bits in the flags member of WINDOWPOS.

WM_WINDOWPOSCHANGED = H0047;
发送此消息给那个窗口的大小和位置已经被改变时,来调用setwindowpos函数或其它窗口管理函数
The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function. 
WM_WINDOWPOSCHANGED 
lpwp = (LPWINDOWPOS) lParam; // points to size and position data  
Parameters
lpwp 
Value of lParam. Pointer to a WINDOWPOS structure that contains information about the window‘s new size and position. 
Return Values
If an application processes this message, it should return zero. 
Default Action
The DefWindowProc function sends the WM_SIZE and WM_MOVE messages to the window. 
Remarks
The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient to perform any move or size change processing during the WM_WINDOWPOSCHANGED message without calling DefWindowProc.

WM_POWER = H0048;(适用于16位的windows)
当系统将要进入暂停状态时发送此消息
The WM_POWER message is sent when the system, typically a battery-powered personal computer, is about to enter suspended mode. 
The WM_POWER message is obsolete. It is provided to simplify porting of 16-bit Windows-based applications. New Win32-based applications should use the WM_POWERBROADCAST message.
WM_POWER 
fwPowerEvt = wParam;    // power-event notification message  
Parameters
fwPowerEvt 
Value of wParam. Specifies a power-event notification message. This parameter can be one of the following values: Value Meaning 
PWR_CRITICALRESUME Indicates that the system is resuming operation after entering suspended mode without first sending a PWR_SUSPENDREQUEST notification message to the application. An application should perform any necessary recovery actions. 
PWR_SUSPENDREQUEST Indicates that the system is about to enter suspended mode. 
PWR_SUSPENDRESUME Indicates that the system is resuming operation after having entered suspended mode normally — that is, the system sent a PWR_SUSPENDREQUEST notification message to the application before the system was suspended. An application should perform any necessary recovery actions. 
Return Values
The value an application returns depends on the value of the wParam parameter. If wParam is PWR_SUSPENDREQUEST, the return value is PWR_FAIL to prevent the system from entering the suspended state; otherwise, it is PWR_OK. If wParam is PWR_SUSPENDRESUME or PWR_CRITICALRESUME, the return value is zero.

WM_COPYDATA = H004A;
当一个应用程序传递数据给另一个应用程序时发送此消息
The WM_COPYDATA message is sent when an application passes data to another application. 
WM_COPYDATA 
wParam = (WPARAM) (HWND) hwnd;            // handle of sending window 
lParam = (LPARAM) (PCOPYDATASTRUCT) pcds; // pointer to structure with data  
Parameters
hwnd 
Handle to the window passing the data. 
pcds 
Pointer to a COPYDATASTRUCT structure that contains the data to be passed. 
Return Values
If the receiving application processes this message, it should return TRUE; otherwise, it should return FALSE. 
Remarks
An application must use theSendMessage function to send this message, not thePostMessage function.
The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data. 
While this message is being sent, the referenced data must not be changed by another thread of the sending process. 
The receiving application should consider the data read-only. The pcds parameter is valid only during the processing of the message. The receiving application should not free the memory referenced by pcds. If the receiving application must access the data after SendMessage returns, it must copy the data into a local buffer.

WM_CANCELJOURNAL = H004B;
当某个用户取消程序日志激活状态,提交此消息给程序
The WM_CANCELJOURNAL message is posted to an application when a user cancels the application‘s journaling activities. The message is posted with a NULL window handle. 
WM_CANCELJOURNAL 
wParam = 0; // not used, must be zero 
lParam = 0; // not used, must be zero  
Parameters
This message has no parameters. 
Return Values
This message does not return a value. It is meant to be processed from within an application‘s main loop or aGetMessage hook procedure, not from a window procedure. 
Remarks
Journal record and playback modes are modes imposed on the system that let an application sequentially record or play back user input. The system enters these modes when an application installs a JournalRecordProc or JournalPlaybackProc hook procedure. When the system is in either of these journaling modes, applications must take turns reading input from the input queue. If any one application stops reading input while the system is in a journaling mode, other applications are forced to wait. 
To ensure a robust system, one that cannot be hung up by any one application, the system automatically cancels any journaling activities when a user presses CTRL+ESC or CTRL+ALT+DEL. The system then unhooks any journaling hook procedures, and posts a WM_CANCELJOURNAL message, with a NULL window handle, to the application that set the journaling hook. 
Since the WM_CANCELJOURNAL has a NULL window handle, it cannot be dispatched to a window procedure. There are two ways for an application to see a WM_CANCELJOURNAL message: If the application is running in its own main loop, it must catch the message between its call toGetMessage orPeekMessage and its call toDispatchMessage. If the application is not running in its own main loop, it must set a GetMsgProc hook procedure (via a call to SetWindowsHookEx specifying the WH_GETMESSAGE hook type) that watches for the message. 
When an application sees a WM_CANCELJOURNAL message, it can assume two things: the user has intentionally cancelled the journal record or playback mode, and the system has already unhooked any journal record or playback hook procedures. 
Note that the key combinations mentioned above (CTRL+ESC or CTRL+ALT+DEL) cause the system to cancel journaling. If any one application is hung, they give the user a means of recovery. The VK_CANCEL virtual keycode (usually implemented as the CTRL+BREAK key combination) is what an application that is in journal record mode should watch for as a signal that the user wishes to cancel the journaling activity. The difference is that watching for VK_CANCEL is a suggested behavior for journaling applications, whereas CTRL+ESC or CTRL+ALT+DEL cause the system to cancel journalling regardless of a journalling application‘s behavior.

WM_NOTIFY = H004E;
当某个控件的某个事件已经发生或这个控件需要得到一些信息时,发送此消息给它的父窗口
WM_NOTIFY
WM_NOTIFY 
idCtrl = (int) wParam; 
pnmh = (LPNMHDR) lParam; 
Sent by a common control to its parent window when an event has occurred in the control or the control requires some kind of information. 
The return value is ignored except for notification messages that specify otherwise. 
idCtrl 
Identifier of the common control sending the message. This identifier is not guaranteed(保证) to be unique. An application should use the hwndFrom or idFrom member of the NMHDR structure (passed as the lParam parameter) to identify the control. 
pnmh 
Address of an NMHDR structure that contains the notification code and additional information. For some notification messages, this parameter points to a larger structure that has the NMHDR structure as its first member. 
Not all controls will send WM_NOTIFY messages. In particular(特别), the standard Windows controls (edit controls, combo boxes, list boxes, buttons, scroll bars, and static controls) do not send WM_NOTIFY messages. Consult(参考) the documentation for the control to determine if it will send any WM_NOTIFY messages and, if it will, which notification codes it will send.

WM_INPUTLANGCHANGEREQUEST = H0050;
当用户选择某种输入语言,或输入语言的热键改变
The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately.
WM_INPUTLANGCHANGEREQUEST
fSysCharSet = (BOOL) wParam 
hkl = (HKL) lParam;  
Parameters
wParam 
The lowest bit of this parameter is set if the handle to the keyboard layout can be used with the system character set. The other bits are reserved. 
hkl 
Handle to the new keyboard layout. 
Return Values
This message is posted, not sent, to the application, so the return value is ignored. To accept the change, the application should pass the message to DefWindowProc. To reject the change, the application should return zero without calling DefWindowProc.
Default Action
When the DefWindowProc function receives the WM_INPUTLANGCHANGEREQUEST message, it activates the new input locale and notifies the application of the change by sending the WM_INPUTLANGCHANGE message. 
Remarks
The language indicator is only present on the taskbar if you have installed more than one keyboard layout and if you have enabled the indicator using the Keyboard control panel application.

WM_INPUTLANGCHANGE = H0051;
当平台现场已经被改变后发送此消息给受影响的最顶级窗口
The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application‘s input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on. 
WM_INPUTLANGCHANGE
charset = wParam;
hkl = (HKL) lParam;  
Parameters
charset 
Specifies the character set of the new keyboard layout. 
hkl 
Handle to the new keyboard layout. 
Return Values
An application should return nonzero if it processes this message.

WM_TCARD = H0052;
当程序已经初始化windows帮助例程时发送此消息给应用程序
WM_TCARD 
idAction = wParam; 
dwActionData = lParam; 
Sent to an application that has initiated a training card with Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function. 
The return value is ignored; use zero. 
idAction 
Value that indicates the action the user has taken. This can be one of these values: IDABORT The user clicked an authorable Abort button. 
IDCANCEL The user clicked an authorable Cancel button. 
IDCLOSE The user closed the training card. 
IDHELP The user clicked an authorable Windows Help button. 
IDIGNORE The user clicked an authorable Ignore button. 
IDOK The user clicked an authorable OK button. 
IDNO The user clicked an authorable No button. 
IDRETRY The user clicked an authorable Retry button. 
HELP_TCARD_DATA The user clicked an authorable button. The lParam parameter contains a long integer specified by the Help author. 
HELP_TCARD_NEXT The user clicked an authorable Next button. 
HELP_TCARD_OTHER_CALLER Another application has requested training cards. 
IDYES The user clicked an authorable Yes button. 
dwActionData 
If idAction specifies HELP_TCARD_DATA, this parameter is a long integer specified by the Help author. Otherwise, this parameter is zero.

WM_HELP = H0053;
消息显示用户按下了F1,如果某个菜单是激活的,就发送此消息个此窗口关联的菜单,否则就发送给有焦点的窗口,如果当前都没有焦点,就把此消息发送给当前激活的窗口
Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window. 
Syntax 
WM_HELP 
lphi = (LPHELPINFO) lParam; 
Parameters
lphi 
Address of a HELPINFO structure that contains information about the menu item, control, dialog box, or window for which Help is requested. 
Return Values
Returns TRUE.
Remarks
TheDefWindowProc function passes WM_HELP to the parent window of a child window or to the owner of a top-level window.

WM_USERCHANGED = H0054;
当用户已经登入或退出后发送此消息给所有的窗口,当用户登入或退出时系统更新用户的具体设置信息,在用户更新设置时系统马上发送此消息
The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings. 
WM_USERCHANGED 
wParam = 0;       // not used, must be zero 
lParam = 0;       // not used, must be zero  
Return Values
An application should return zero if it processes this message.

WM_NOTIFYFORMAT = H0055;
公用控件,自定义控件和他们的父窗口通过此消息来判断控件是使用ANSI还是UNICODE结构在WM_NOTIFY消息,使用此控件能使某个控件与它的父控件之间进行相互通信
WM_NOTIFYFORMAT
hwndFrom = (HWND) wParam; 
Command = lParam; 
Used to determine if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control. 
Returns one of the following: NFR_ANSI  ANSI structures should be used in WM_NOTIFY messages sent by the control. 
NFR_UNICODE  Unicode structures should be used in WM_NOTIFY messages sent by the control.  
0  An error occurred. 
If Command is NF_REQUERY, the return value is the result of the requery operation. 
hwndFrom 
Handle to the window that is sending the WM_NOTIFYFORMAT message. If Command is NF_QUERY, this parameter is the handle to a control. If Command is NF_REQUERY, this parameter is the handle to the parent window of a control. 
Command 
Command value that specifies the nature of the WM_NOTIFYFORMAT message. This will be one of the following values: NF_QUERY  The message is a query to determine whether ANSI or Unicode structures should be used in WM_NOTIFY messages. This command is sent from a control to its parent window during the creation of a control and in response to an NF_REQUERY command. 
NF_REQUERY  The message is a request for a control to send an NF_QUERY form of this message to its parent window. This command is sent from the parent window. The parent window is asking the control to requery it about the type of structures to use in WM_NOTIFY messages. 
When a common control is created, the control sends a WM_NOTIFYFORMAT message to its parent window to determine the type of structures to use in WM_NOTIFY messages. If the parent window does not handle this message, theDefWindowProc function responds according to the type of the parent window. That is, if the parent window is a Unicode window, DefWindowProc returns NFR_UNICODE, and if the parent window is an ANSI window, DefWindowProc returns NFR_ANSI. If the parent window is a dialog box and does not handle this message, theDefDlgProc function similarly responds according to the type of the dialog box (Unicode or ANSI). 
A parent window can change the type of structures a common control uses in WM_NOTIFY messages by setting lParam to NF_REQUERY and sending a WM_NOTIFYFORMAT message to the control. This causes the control to send an NF_QUERY form of the WM_NOTIFYFORMAT message to the parent window. 
Not all controls will send WM_NOTIFYFORMAT messages. In particular, the standard Windows controls (edit controls, combo boxes, list boxes, buttons, scroll bars, and static controls) do not send WM_NOTIFYFORMAT messages. Consult the documentation for the control to determine if it will send the WM_NOTIFYFORMAT message.

WM_CONTEXTMENU = H007B;
当用户某个窗口中点击了一下右键就发送此消息给这个窗口
The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right clicked) in the window.
hwnd = (HWND) wParam; 
xPos = LOWORD(lParam); 
yPos = HIWORD(lParam); 
Parameters
hwnd 
Handle to the window in which the user right clicked the mouse. This can be a child window of the window receiving the message. For more information about processing this message, see the Remarks section. 
xPos 
Horizontal position of the cursor, in screen coordinates, at the time of the mouse click. 
yPos 
Vertical position of the cursor, in screen coordinates, at the time of the mouse click. 
Return Values
No return value.
Remarks
A window can process this message by displaying a shortcut menu using the TrackPopupMenu or TrackPopupMenuEx function.
If a window does not display a shortcut menu it should pass this message to the DefWindowProc function. If a window is a child window, DefWindowProc sends the message to the parent. Otherwise, DefWindowProc displays a default shortcut menu if the specified position is in the window‘s caption.
DefWindowProc generates the WM_CONTEXTMENU message when it processes the WM_RBUTTONUP or WM_NCRBUTTONUP message.

WM_STYLECHANGING = H007C;
当调用SETWINDOWLONG函数将要改变一个或多个 窗口的风格时发送此消息给那个窗口
The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window‘s styles.
WM_STYLECHANGING 
wStyleType = wParam;            // window styles or extended styles 
lpss = (LPSTYLESTRUCT) lParam;  // structure containing new styles 
 Parameters
wStyleType 
Value of wParam. Specifies whether the window‘s styles or extended styles have changed. This parameter can be a combination of the following values: Value Meaning 
GWL_EXSTYLE The window‘s extended styles are changing. 
GWL_STYLE The window‘s styles are changing. 
lpss 
Value of lParam. Pointer to a STYLESTRUCT structure that contains the proposed new styles for the window. An application can examine the styles and, if necessary, change them. 
Return Values
An application should return zero if it processes this message.

WM_STYLECHANGED = H007D;
当调用SETWINDOWLONG函数一个或多个 窗口的风格后发送此消息给那个窗口
The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window‘s styles.
WM_STYLECHANGED 
wStyleType = wParam;            // windows styles or extended styles 
lpss = (LPSTYLESTRUCT) lParam;  // structure containing new styles  
Parameters
wStyleType 
Value of wParam. Specifies whether the window‘s styles or extended styles have changed. This parameter can be a combination of the following values: Value Meaning 
GWL_EXSTYLE The window‘s extended styles have changed. 
GWL_STYLE The window‘s styles have changed. 
lpss 
Value of lParam. Pointer to a STYLESTRUCT structure that contains the new styles for the window. An application can examine the styles, but can not change them. 
Return Values
An application should return zero if it processes this message.

WM_DISPLAYCHANGE = H007E;
当显示器的分辨率改变后发送此消息给所有的窗口
The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
WM_DISPLAYCHANGE 
cBitsPerPixel = wParam; 
cxScreen = LOWORD(lParam); 
cyScreen = HIWORD(lParam);  
Parameters
cBitsPerPixel 
Specifies the new image depth of the display in bits per pixel. 
cxScreen 
Specifies the new horizontal resolution of the screen. 
cyScreen 
Specifies the new vertical resolution of the screen.

WM_GETICON = H007F;
消息发送给某个窗口来返回与某个窗口有关连的大图标或小图标的句柄;
The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the Alt+Tab dialog, and the small icon in the window caption. 
WM_GETICON 
fType = wParam;  // icon type 
Parameters
fType 
Value of wParam. Specifies the type of icon being retrieved. This parameter can be one of the following values: Value Meaning 
ICON_BIG Retrieve the large icon for the window. 
ICON_SMALL Retrieve the small icon for the window. 
Return Values
The return value is a handle to the large or small icon, depending on the value of fType. When an application receives this message, it can return a handle to a large or small icon, or pass the message to DefWindowProc.
Default Action
DefWindowProc returns a handle to the large or small icon associated with the window, depending on the value of fType.
Remarks
When an application receives this message, it can return a handle to a large or small icon, or pass the message to DefWindowProc.

WM_SETICON = H0080;
程序发送此消息让一个新的大图标或小图标与某个窗口关联;
An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption. 
WM_SETICON 
wParam = (WPARAM) fType;          // icon type
lParam = (LPARAM) (HICON) hicon;  // handle to icon 
Parameters
fType 
Value of wParam. Specifies the type of icon being set. This parameter can be one of the following values: Value Meaning 
ICON_BIG Set the large icon for the window. 
ICON_SMALL Set the small icon for the window. 
hicon 
Value of lParam. Handle to the new large or small icon. If this parameter is NULL, the icon indicated by fType is removed. 
Return Values
The return value is a handle to the previous large or small icon, depending on the value of fType. It is NULL if the window previously had no icon of the type indicated by fType.
Default Action
The DefWindowProc function returns a handle to the previous large or small icon associated with the window, depending on the value of fType.

WM_NCCREATE = H0081;
当某个窗口第一次被创建时,此消息在WM_CREATE消息发送前发送;
The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created. 
WM_NCCREATE 
lpcs = (LPCREATESTRUCT) lParam;  // structure with creation data  
Parameters
lpcs 
Value of lParam. Pointer to the CREATESTRUCT structure that contains information about the window being created. The members of CREATESTRUCT are identical to the parameters of the CreateWindowEx function. . 
Return Values
If an application processes this message, it should return TRUE to continue creation of the window. If the application returns FALSE, the CreateWindow or CreateWindowEx function will return a NULL handle.

WM_NCDESTROY = H0082;
消息通知某个窗口,非客户区正在销毁
The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window. 
WM_NCDESTROY  
Parameters
This message has no parameters. 
Return Values
If an application processes this message, it should return zero. 
Remarks
This message frees any memory internally allocated for the window.

WM_NCCALCSIZE = H0083;
当某个窗口的客户区域必须被核算时发送此消息
The WM_NCCALCSIZE message is sent when the size and position of a window‘s client area must be calculated. By processing this message, an application can control the content of the window‘s client area when the size or position of the window changes. 
WM_NCCALCSIZE 
fCalcValidRects = (BOOL) wParam;        // valid area flag 
lpncsp = (LPNCCALCSIZE_PARAMS) lParam;  // size calculation data 
   or
lpncsp = (LPRECT) lParam;               // new window coordinates
Parameters
fCalcValidRects 
The value of wParam. If wParam is TRUE, it specifies that the application should indicate which part of the client area contains valid information. The system copies the valid information to the specified area within the new client area. 
If wParam is FALSE, the application does not need to indicate the valid part of the client area.
lpncsp 
Value of lParam. If wParam is TRUE, lParam points to an NCCALCSIZE_PARAMS structure that contains information an application can use to calculate the new size and position of the client rectangle. 
If wParam is FALSE, lParam points to a RECT structure. On entry, the structure contains the proposed window rectangle for the window. On exit, the structure should contain the screen coordinates of the corresponding window client area.
Return Values
If the fCalcValidRects parameter is FALSE, the application should return zero.
If fCalcValidRects is TRUE, the application should return zero or a combination of the following values: 
Value Meaning 
WVR_ALIGNTOP, WVR_ALIGNLEFT, WVR_ALIGNBOTTOM, WVR_ALIGNRIGHT 
 These values, used in combination, specify that the client area of the window is to be preserved and aligned appropriately relative to the new position of the window. For example, to align the client area to the lower-left corner, return the WVR_ALIGNLEFT and WVR_ALIGNBOTTOM values. 
WVR_HREDRAW, WVR_VREDRAW 
 These values, used in combination with any other values, cause the window to be completely redrawn if the client rectangle changes size horizontally or vertically. These values are similar to the CS_HREDRAW and CS_VREDRAW class styles. 
WVR_REDRAW 
 This value causes the entire window to be redrawn. It is a combination of WVR_HREDRAW and WVR_VREDRAW values. 
WVR_VALIDRECTS 
 This value indicates that, upon return from WM_NCCALCSIZE, the rectangles specified by the rgrc[1] and rgrc[2] members of the NCCALCSIZE_PARAMS structure contain valid destination and source area rectangles, respectively. The system combines these rectangles to calculate the area of the window to be preserved. The system copies any part of the window image that is within the source rectangle and clips the image to the destination rectangle. Both rectangles are in parent-relative or screen-relative coordinates. 
 This return value allows an application to implement more elaborate client-area preservation strategies, such as centering or preserving a subset of the client area. 
If fCalcValidRects is TRUE and an application returns zero, the old client area is preserved and is aligned with the upper-left corner of the new client area. 
Default Action
The window may be redrawn, depending on whether the CS_HREDRAW or CS_VREDRAW class style is specified. This is the default, backward-compatible processing of this message by the DefWindowProc function (in addition to the usual client rectangle calculation described in the preceding table).

WM_NCHITTEST = H0084;
移动鼠标,按住或释放鼠标时发生
The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse. 
WM_NCHITTEST 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor  
Parameters
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. 
Return Values
The return value of the DefWindowProc function is one of the following values, indicating the position of the cursor hot spot: 
Value Location of hot spot 
HTBORDER In the border of a window that does not have a sizing border 
HTBOTTOM In the lower horizontal border of a resizable window (the user can click the mouse to resize the window vertically) 
HTBOTTOMLEFT In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally) 
HTBOTTOMRIGHT In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally) 
HTCAPTION In a title bar 
HTCLIENT In a client area 
HTCLOSE In a close button 
HTERROR On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error) 
HTGROWBOX In a size box (same as HTSIZE) 
HTHELP In a Help button 
HTHSCROLL In a horizontal scroll bar 
HTLEFT In the left border of a resizable window (the user can click the mouse to resize the window horizontally) 
HTMENU In a menu 
HTMAXBUTTON In Maximize button 
HTMINBUTTON In Minimize button 
HTNOWHERE On the screen background or on a dividing line between windows 
HTREDUCE In a Minimize button 
HTRIGHT In the right border of a resizable window (the user can click the mouse to resize the window horizontally) 
HTSIZE In a size box (same as HTGROWBOX) 
HTSYSMENU In a System menu or in a Close button in a child window 
HTTOP In the upper horizontal border of a window 
HTTOPLEFT In the upper-left corner of a window border 
HTTOPRIGHT In the upper right corner of a window border 
HTTRANSPARENT In a window currently covered by another window in the same thread (the message will be sent to underlying windows in the same thread until one of them returns a code that is not HTTRANSPARENT) 
HTVSCROLL In the vertical scroll bar 
HTZOOM In a Maximize button 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_NCPAINT = H0085;
程序发送此消息给某个窗口当它(窗口)的框架必须被绘制时;可以在该函数中更改框架的更新区域。
An application sends the WM_NCPAINT message to a window when its frame must be painted. 
WM_NCPAINT 
hrgn = (HRGN) wParam;   // handle of update region  
Parameters
hrgn 
Value of wParam. Handle to the update region of the window. The update region is clipped to the window frame. When wParam is 1, the entire window frame needs to be updated. 
This value can be passed to GetDCEx as in the following example. 
case WM_NCPAINT:
{
    HDC hdc;
    hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
    // Paint into this DC
    ReleaseDC(hwnd, hdc);

Return Values
An application returns zero if it processes this message. 
Remarks
The DefWindowProc function paints the window frame. 
An application can intercept the WM_NCPAINT message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

WM_NCACTIVATE = H0086;
消息发送给某个窗口 仅当它的非客户区需要被改变来显示是激活还是非激活状态;
The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state. 
WM_NCACTIVATE 
fActive = (BOOL) wParam;   // new state of the title bar or icon  
Parameters
fActive 
Value of wParam. Specifies when a title bar or icon needs to be changed to indicate an active or inactive state. If an active title bar or icon is to be drawn, the fActive parameter is TRUE. It is FALSE for an inactive title bar or icon. 
Return Values
When the fActive parameter is FALSE, an application should return TRUE to indicate that the system should proceed with the default processing, or it should return FALSE to prevent the title bar or icon from being deactivated. When fActive is TRUE, the return value is ignored. 
Default Action
The DefWindowProc function draws the title bar or icon title in its active colors when the fActive parameter is TRUE and in its inactive colors when fActive is FALSE.

WM_GETDLGCODE = H0087;
发送此消息给某个与对话框程序关联的控件,widdows控制方位键和TAB键使输入进入此控件通过响应WM_GETDLGCODE消息,应用程序可以把他当成一个特殊的输入控件并能处理它
The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
WM_GETDLGCODE 
wParam;                // not used 
pMsg = (LPMSG) lParam; // pointer to an MSG structure  
Parameters
pMsg 
The value of lParam is NULL if the system is performing a query, or lParam is a pointer to an MSG structure. 
Return Values
The return value is one or more of the following values, indicating which type of input the application processes. 
Value Meaning 
DLGC_BUTTON Button. 
DLGC_DEFPUSHBUTTON Default push button. 
DLGC_HASSETSEL EM_SETSEL messages. 
DLGC_RADIOBUTTON Radio button. 
DLGC_STATIC Static control. 
DLGC_UNDEFPUSHBUTTON Non-default push button. 
DLGC_WANTALLKEYS All keyboard input. 
DLGC_WANTARROWS Direction keys. 
DLGC_WANTCHARS WM_CHAR messages. 
DLGC_WANTMESSAGE All keyboard input (the application passes this message in the MSG structure to the control). 
DLGC_WANTTAB tab key. 
Default Action
The DefWindowProc function returns zero. 
Remarks
Although the DefWindowProc function always returns zero in response to the WM_GETDLGCODE message, the window procedure for the predefined control classes return a code appropriate for each class. 
The WM_GETDLGCODE message and the returned values are useful only with user-defined dialog box controls or standard controls modified by subclassing.

WM_NCMOUSEMOVE = H00A0;
当光标在一个窗口的非客户区内移动时发送此消息给这个窗口 //非客户区为:窗体的标题栏及窗 的边框体
The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCMOUSEMOVE 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Remarks
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_NCLBUTTONDOWN = H00A1;
当光标在一个窗口的非客户区同时按下鼠标左键时提交此消息
The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCLBUTTONDOWN 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Default Action
The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_NCLBUTTONUP = H00A2;
当用户释放鼠标左键同时光标某个窗口在非客户区十发送此消息
The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCLBUTTONUP 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // mouse-cursor coordinates  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Default Action
The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

WM_NCLBUTTONDBLCLK = H00A3;
当用户双击鼠标左键同时光标某个窗口在非客户区十发送此消息
The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCLBUTTONDBLCLK 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Default Action
The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window. 
Remarks
A window need not have the CS_DBLCLKS style to receive WM_NCLBUTTONDBLCLK messages. 
The system generates a WM_NCLBUTTONDBLCLK message when the user presses, releases, and again presses the left mouse button within the system‘s double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_NCLBUTTONDBLCLK, and WM_NCLBUTTONUP again. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_NCRBUTTONDOWN = H00A4;
当用户按下鼠标右键同时光标又在窗口的非客户区时发送此消息
The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCRBUTTONDOWN 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

WM_NCRBUTTONUP = H00A5;
当用户释放鼠标右键同时光标又在窗口的非客户区时发送此消息
The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCRBUTTONUP 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero.
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

WM_NCRBUTTONDBLCLK = H00A6;
当用户双击鼠标右键同时光标某个窗口在非客户区十发送此消息
The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCRBUTTONDBLCLK 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Remarks
A window need not have the CS_DBLCLKS style to receive WM_NCRBUTTONDBLCLK messages. 
The system generates a WM_NCRBUTTONDBLCLK message when the user presses, releases, and again presses the right mouse button within the system‘s double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_NCRBUTTONDBLCLK, and WM_NCRBUTTONUP again. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

WM_NCMBUTTONDOWN = H00A7;
当用户按下鼠标中键同时光标又在窗口的非客户区时发送此消息
The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCMBUTTONDOWN 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor 
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

WM_NCMBUTTONUP = H00A8;
当用户释放鼠标中键同时光标又在窗口的非客户区时发送此消息
The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCMBUTTONUP 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor 
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

WM_NCMBUTTONDBLCLK = H00A9;
当用户双击鼠标中键同时光标又在窗口的非客户区时发送此消息
The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
WM_NCMBUTTONDBLCLK 
nHittest = (INT) wParam;    // hit-test value 
pts = MAKEPOINTS(lParam);   // position of cursor  
Parameters
nHittest 
Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
pts 
Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
Return Values
If an application processes this message, it should return zero. 
Remarks
A window need not have the CS_DBLCLKS style to receive WM_NCMBUTTONDBLCLK messages. 
The system generates a WM_NCMBUTTONDBLCLK message when the user presses, releases, and again presses the middle mouse button within the system‘s double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_NCMBUTTONDBLCLK, and WM_NCMBUTTONUP again. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

WM_KEYFIRST = H0100;

WM_KEYDOWN = H0100; 
按下一个键
The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the alt key is not pressed. 
WM_KEYDOWN 
nVirtKey = (int) wParam;    // virtual-key code 
lKeyData = lParam;          // key data  
Parameters
nVirtKey 
Value of wParam. Specifies the virtual-key code of the nonsystem key. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is always 0 for a WM_KEYDOWN message. 
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
31 Specifies the transition state. The value is always 0 for a WM_KEYDOWN message. 
Return Values
An application should return zero if it processes this message. 
Default Action
If the f10 key is pressed, the DefWindowProc function sets an internal flag. When DefWindowProc receives the WM_KEYUP message, the function checks whether the internal flag is set and, if so, sends a WM_SYSCOMMAND message to the top-level window. The wParam parameter of the message is set to SC_KEYMENU. 
Remarks
Because of the autorepeat feature, more than one WM_KEYDOWN message may be posted before a WM_KEYUP message is posted. The previous key state (bit 30) can be used to determine whether the WM_KEYDOWN message indicates the first down transition or a repeated down transition. 
For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

WM_KEYUP = H0101; 
释放一个键
The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the alt key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus. 
WM_KEYUP 
nVirtKey = (int) wParam;    // virtual-key code 
lKeyData = lParam;          // key data 
 Parameters
nVirtKey 
Value of wParam. Specifies the virtual-key code of the nonsystem key. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. The repeat count is always one for a WM_KEYUP message. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is always 0 for a WM_KEYUP message. 
30 Specifies the previous key state. The value is always 1 for a WM_KEYUP message. 
31 Specifies the transition state. The value is always 1 for a WM_KEYUP message. 
Return Values
An application should return zero if it processes this message. 
Default Action
The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the f10 key or the alt key was released. The wParam parameter of the message is set to SC_KEYMENU. 
Remarks
For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

WM_CHAR = H0102; 
按下某键,并已发出WM_KEYDOWN, WM_KEYUP消息
The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. WM_CHAR contains the character code of the key that was pressed. 
WM_CHAR 
chCharCode = (TCHAR) wParam;    // character code 
lKeyData = lParam;              // key data  
Parameters
chCharCode 
Value of wParam. Specifies the character code of the key. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
Return Values
An application should return zero if it processes this message. 
Remarks
Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lKeyData parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_CHAR message. 
For enhanced 101- and 102-key keyboards, extended keys are the right alt and the right ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lKeyData parameter.

WM_DEADCHAR = H0103;
当用translatemessage函数翻译WM_KEYUP消息时发送此消息给拥有焦点的窗口
The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (?) is generated by typing the dead key for the umlaut character, and then typing the O key. 
WM_DEADCHAR 
chCharCode = (TCHAR) wParam;    // character code 
lKeyData = lParam;              // key data  
Parameters
chCharCode 
Value of wParam. Specifies the character code generated by the dead key. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
Return Values
An application should return zero if it processes this message. 
Remarks
The WM_DEADCHAR message typically is used by applications to give the user feedback about each key pressed. For example, an application can display the accent in the current character position without moving the caret. 
Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lKeyData parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_DEADCHAR message. 
For enhanced 101- and 102-key keyboards, extended keys are the right alt and the right ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lKeyData parameter.

WM_SYSKEYDOWN = H0104;
当用户按住ALT键同时按下其它键时提交此消息给拥有焦点的窗口;
The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the alt key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lKeyData parameter. 
WM_SYSKEYDOWN 
nVirtKey = (int) wParam;    // virtual-key code 
lKeyData = lParam;          // key data  
Parameters
nVirtKey 
Value of wParam. Specifies the virtual-key code of the key being pressed. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus. 
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
31 Specifies the transition state. The value is always 0 for a WM_SYSKEYDOWN message. 
Return Values
An application should return zero if it processes this message. 
Default Action
The DefWindowProc function examines the given key and generates a WM_SYSCOMMAND message if the key is either tab or enter. 
Remarks
When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus. 
Because of automatic repeat, more than one WM_SYSKEYDOWN message may occur before a WM_SYSKEYUP message is sent. The previous key state (bit 30) can be used to determine whether the WM_SYSKEYDOWN message indicates the first down transition or a repeated down transition. 
For enhanced 101- and 102-key keyboards, enhanced keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.
This message is also sent whenever the user presses the F10 key without the ALT key.

WM_SYSKEYUP = H0105;
当用户释放一个键同时ALT 键还按着时提交此消息给拥有焦点的窗口
The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the alt key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lKeyData parameter. 
WM_SYSKEYUP 
nVirtKey = (int) wParam;    // virtual-key code 
lKeyData = lParam;          // key data  
Parameters
nVirtKey 
Value of wParam. Specifies the virtual-key code of the key being released. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. The repeat count is always one for a WM_SYSKEYUP message. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is 1 if the ALT key is down while the key is released; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus. 
30 Specifies the previous key state. The value is always 1 for a WM_SYSKEYUP message. 
31 Specifies the transition state. The value is always 1 for a WM_SYSKEYUP message. 
Return Values
An application should return zero if it processes this message. 
Default Action
The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the f10 key or the alt key was released. The wParam parameter of the message is set to SC_KEYMENU. 
Remarks
When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus. 
For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter. 
For non-U.S. enhanced 102-key keyboards, the right alt key is handled as a ctrl+alt key. The following table shows the sequence of messages that result when the user presses and releases this key. 
Message Virtual-key code 
WM_KEYDOWN VK_CONTROL 
WM_KEYDOWN VK_MENU 
WM_KEYUP VK_CONTROL 
WM_SYSKEYUP VK_MENU

WM_SYSCHAR = H0106;
当WM_SYSKEYDOWN消息被TRANSLATEMESSAGE函数翻译后提交此消息给拥有焦点的窗口
The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the alt key is down. 
WM_SYSCHAR 
chCharCode = (TCHAR) wParam;   // character code 
lKeyData = lParam;             // key data 
 Parameters
chCharCode 
Value of wParam. Specifies the character code of the window menu key. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table: Value Meaning 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke was auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
Return Values
An application should return zero if it processes this message. 
Remarks
When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a standard key message instead of a system character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus. 
For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; the print scrn key; the break key; the numlock key; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

WM_SYSDEADCHAR = H0107;
当WM_SYSKEYDOWN消息被TRANSLATEMESSAGE函数翻译后发送此消息给拥有焦点的窗口
The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the alt key. 
WM_SYSDEADCHAR 
chCharCode = (TCHAR) wParam;    // character code 
lKeyData = lParam;              // key data  
Parameters
chCharCode 
Value of wParam. Specifies the character code generated by the system dead key — that is, a dead key that is pressed while holding down the alt key. 
lKeyData 
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
25–28 Reserved; do not use. 
29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
Return Values
An application should return zero if it processes this message. 
Remarks
For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

WM_KEYLAST = H0108;

WM_INITDIALOG = H0110;
在一个对话框程序被显示前发送此消息给它,通常用此消息初始化控件和执行其它任务
The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box. 
WM_INITDIALOG 
hwndFocus = (HWND) wParam; // handle of control to receive focus 
lInitParam = lParam;       // initialization parameter  
Parameters
hwndFocus 
Value of wParam. Identifies the control to receive the default keyboard focus. The system assigns the default keyboard focus only if the dialog box procedure returns TRUE. 
lInitParam 
Value of lParam. Specifies additional initialization data. This data is passed to the system as the lParamInit parameter in a call to the CreateDialogIndirectParam, CreateDialogParam, DialogBoxIndirectParam, or DialogBoxParam function used to create the dialog box. For property sheets, this parameter is a pointer to thePROPSHEETPAGE structure used to create the page. This parameter is zero if any other dialog box creation function is used. 
Return Values
The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control given by hwndFocus. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus. 
The dialog box procedure should return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored. 
Remarks
The control to receive the default keyboard focus is always the first control in the dialog box that is visible, not disabled, and that has the WS_TABSTOP style. When the dialog box procedure returns TRUE, the system checks the control to ensure that the procedure has not disabled it. If it has been disabled, the system sets the keyboard focus to the next control that is visible, not disabled, and has the WS_TABSTOP. 
An application can return FALSE only if it has set the keyboard focus to one of the controls of the dialog box.

WM_COMMAND = H0111;
当用户选择一条菜单命令项或当某个控件发送一条消息给它的父窗口,一个快捷键被翻译
The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated. 
WM_COMMAND
wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam);         // item, control, or accelerator identifier
hwndCtl = (HWND) lParam;      // handle of control
Parameters
wNotifyCode
Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0. 
wID 
Value of the low-order word of wParam. Specifies the identifier of the menu item, control, or accelerator. 
hwndCtl 
Value of lParam. Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL. 
Return Values
If an application processes this message, it should return zero. 
Remarks
Accelerator keystrokes按键 that select items from the window menu are translated into WM_SYSCOMMAND messages. 
If an accelerator keystroke occurs that corresponds(适合) to a menu item when the window that owns the menu is minimized, no WM_COMMAND message is sent. However, if an accelerator keystroke occurs that does not match any of the items in the window‘s menu or in the window menu, a WM_COMMAND message is sent, even if the window is minimized. 
If an application enables a menu separator, the system sends a WM_COMMAND message with the low-word of the wParam parameter set to zero when the user selects the separator.

WM_SYSCOMMAND = H0112;
A window receives this message when the user chooses a command from the window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.
WM_SYSCOMMAND 
uCmdType = wParam;        // type of system command requested 
xPos = LOWORD(lParam);    // horizontal position, in screen coordinates 
yPos = HIWORD(lParam);    // vertical position, in screen coordinates  
Parameters
uCmdType 
Specifies the type of system command requested. This parameter can be one of the following values. Value Meaning 
SC_CLOSE Closes the window. 
SC_CONTEXTHELP Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message. 
SC_DEFAULT Selects the default item; the user double-clicked the window menu. 
SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate. 
SC_HSCROLL Scrolls horizontally. 
SC_KEYMENU Retrieves the window menu as a result of a keystroke. 
SC_MAXIMIZE Maximizes the window. 
SC_MINIMIZE Minimizes the window. 
SC_MONITORPOWER   Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
lParam can have the following values:
1 means the display is going to low power.
2 means the display is being shut off. 
SC_MOUSEMENU Retrieves the window menu as a result of a mouse click. 
SC_MOVE Moves the window. 
SC_NEXTWINDOW Moves to the next window. 
SC_PREVWINDOW Moves to the previous window. 
SC_RESTORE Restores the window to its normal position and size. 
SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file. 
SC_SIZE Sizes the window. 
SC_TASKLIST Activates the Start menu. 
SC_VSCROLL Scrolls vertically. 
xPos 
Specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. Otherwise, the xPos parameter is not used. 
yPos 
Specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. This parameter is –1 if the command is chosen using a system accelerator, or zero if using a mnenomic. 
Return Values
An application should return zero if it processes this message.
Remarks
The DefWindowProc function carries out the window menu request for the predefined actions specified in the previous table. 
In WM_SYSCOMMAND messages, the four low-order bits of the uCmdType parameter are used internally by the system. To obtain the correct result when testing the value of uCmdType, an application must combine the value 0xFFF0 with the uCmdType value by using the bitwise AND operator. 
The menu items in a window menu can be modified by using the GetSystemMenu, AppendMenu, InsertMenu, ModifyMenu, InsertMenuItem, and SetMenuItem functions. Applications that modify the window menu must process WM_SYSCOMMAND messages.
An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to DefWindowProc. Any WM_SYSCOMMAND messages not handled by the application must be passed to DefWindowProc. Any command values added by an application must be processed by the application and cannot be passed to DefWindowProc. 
Accelerator keys that are defined to choose items from the window menu are translated into WM_SYSCOMMAND messages; all other accelerator keystrokes are translated into WM_COMMAND messages.

WM_TIMER = H0113;
发生了定时器事件
The WM_TIMER message is posted to the installing thread‘s message queue when a timer expires. You can process the message by providing a WM_TIMER case in the window procedure. Otherwise, the default window procedure will call the TimerProc callback function specified in the call to the SetTimer function used to install the timer. 
WM_TIMER 
wTimerID = wParam;             // timer identifier 
tmprc = (TIMERPROC *) lParam;  // address of timer callback  
Parameters
wTimerID 
Value of wParam. Specifies the timer identifier. 
tmprc 
Value of lParam. Points to an application-defined callback function that was passed to the SetTimer function when the timer was installed. 
Return Values
An application should return zero if it processes this message. 
Remarks
The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions retrieve this message only when no other higher-priority messages are in the thread‘s message queue.

WM_HSCROLL = H0114;
当一个窗口标准水平滚动条产生一个滚动事件时发送此消息给那个窗口,也发送给拥有它的控件
The WM_HSCROLL message is sent to a window when a scroll event occurs in the window‘s standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control. 
WM_HSCROLL 
nScrollCode = (int) LOWORD(wParam);  // scroll bar value 
nPos = (short int) HIWORD(wParam);   // scroll box position 
hwndScrollBar = (HWND) lParam;       // handle to scroll bar 
Parameters
nScrollCode 
Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user‘s scrolling request. This parameter can be one of the following values: Value Meaning 
SB_ENDSCROLL Ends scroll. 
SB_LEFT Scrolls to the upper left. 
SB_RIGHT Scrolls to the lower right. 
SB_LINELEFT Scrolls left by one unit. 
SB_LINERIGHT Scrolls right by one unit. 
SB_PAGELEFT Scrolls left by the width of the window. 
SB_PAGERIGHT Scrolls right by the width of the window. 
SB_THUMBPOSITION The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation. 
SB_THUMBTRACK The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The nPos parameter indicates the position that the scroll box has been dragged to. 
nPos 
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used. 
hwndScrollBar 
Value of lParam. If the message is sent by a scroll bar, then hwndScrollBar is the handle to the scroll bar control. If the message is not sent by a scroll bar, hwndScrollBar is NULL. 
Return Values
If an application processes this message, it should return zero. 
Remarks
The SB_THUMBTRACK notification message is typically used by applications that provide feedback as the user drags the scroll box. 
If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function. 
Note that the WM_HSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_HSCROLL (and WM_VSCROLL) for scroll position data have a practical maximum position value of 65,535. 
However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.

WM_VSCROLL = H0115;
当一个窗口标准垂直滚动条产生一个滚动事件时发送此消息给那个窗口,也发送给拥有它的控件
The WM_VSCROLL message is sent to a window when a scroll event occurs in the window‘s standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control. 
WM_VSCROLL 
nScrollCode = (int) LOWORD(wParam); // scroll bar value 
nPos = (short int) HIWORD(wParam);  // scroll box position 
hwndScrollBar = (HWND) lParam;      // handle to scroll bar  
Parameters
nScrollCode 
Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user‘s scrolling request. This parameter can be one of the following values: Value Meaning 
SB_BOTTOM Scrolls to the lower right. 
SB_ENDSCROLL Ends scroll. 
SB_LINEDOWN Scrolls one line down. 
SB_LINEUP Scrolls one line up. 
SB_PAGEDOWN Scrolls one page down. 
SB_PAGEUP Scrolls one page up. 
SB_THUMBPOSITION The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation. 
SB_THUMBTRACK The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The nPos parameter indicates the position that the scroll box has been dragged to. 
SB_TOP Scrolls to the upper left. 
nPos 
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used. 
hwndScrollBar 
Value of lParam. If the message is sent by a scroll bar, then hwndScrollBar is the handle to the scroll bar control. If the message is not sent by a scroll bar, hwndScrollBar is NULL. 
Return Values
If an application processes this message, it should return zero. 
Remarks
The SB_THUMBTRACK notification message is typically used by applications that provide feedback as the user drags the scroll box. 
If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function. 
Note that the WM_VSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_VSCROLL (and WM_HSCROLL) for scroll position data have a practical maximum position value of 65,535. 
However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.

WM_INITMENU = H0116;
当一个菜单将要被激活时发送此消息,它发生在用户菜单条中的某项或按下某个菜单键,它允许程序在显示前更改菜单
The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed. 
WM_INITMENU 
hmenuInit = (HMENU) wParam; // handle to menu to initialize 
 Parameters
hmenuInit 
Value of wParam. Handle to the menu to be initialized. 
Return Values
If an application processes this message, it should return zero. 
Remarks
A WM_INITMENU message is sent only when a menu is first accessed; only one WM_INITMENU message is generated for each access. For example, moving the mouse across several menu items while holding down the button does not generate new messages. WM_INITMENU does not provide information about menu items.

WM_INITMENUPOPUP = H0117;
当一个下拉菜单或子菜单将要被激活时发送此消息,它允许程序在它显示前更改菜单,而不要改变全部 
The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu. 
WM_INITMENUPOPUP 
hmenuPopup = (HMENU) wParam;         // handle to submenu
uPos = (UINT) LOWORD(lParam);        // submenu item position 
fSystemMenu = (BOOL) HIWORD(lParam); // window menu flag 
 Parameters
hmenuPopup 
Value of wParam. Handle to the drop-down menu or submenu. 
uPos 
Value of the low-order word of lParam. Specifies the zero-based relative position of the menu item that opens the drop-down menu or submenu. 
fSystemMenu 
Value of the high-order word of lParam. Specifies whether the drop-down menu is the window menu (also known as the System menu or the Control menu). If the menu is the window menu, this parameter is TRUE; otherwise, it is FALSE. 
Return Values
If an application processes this message, it should return zero.

WM_MENUSELECT = H011F;
当用户选择一条菜单项时发送此消息给菜单的所有者(一般是窗口)
The WM_MENUSELECT message is sent to a menu‘s owner window when the user selects a menu item.
WM_MENUSELECT 
uItem = (UINT) LOWORD(wParam);   // menu item or submenu index 
fuFlags = (UINT) HIWORD(wParam); // menu flags 
hmenu = (HMENU) lParam;          // handle to menu clicked  
Parameters
uItem 
Value of the low-order word of wParam. If the selected item is a command item, this parameter contains the identifier of the menu item. If the selected item opens a drop-down menu or submenu, this parameter contains the menu index of the drop-down menu or submenu in the main menu, and the hMenu parameter then contains the handle to the main (clicked) menu; use the GetSubMenu function to get the menu handle to the drop-down menu or submenu. 
fuFlags 
Value of the high-order word of wParam. Specifies one or more menu flags. This parameter can be a combination of the following values: Value Description 
MF_BITMAP Item displays a bitmap. 
MF_CHECKED Item is checked. 
MF_DISABLED Item is disabled. 
MF_GRAYED Item is grayed. 
MF_HILITE Item is highlighted. 
MF_MOUSESELECT Item is selected with the mouse. 
MF_OWNERDRAW Item is an owner-drawn item. 
MF_POPUP Item opens a drop-down menu or submenu. 
MF_SYSMENU Item is contained in the window menu (also known as the System menu or Control menu). The hmenu parameter identifies the window menu associated with the message. 
hmenu 
Value of lParam. Handle to the menu that was clicked. 
Return Values
If an application processes this message, it should return zero. 
Remarks
If the fuFlags parameter contains 0xFFFF and the hmenu parameter contains NULL, the system has closed the menu. 
Do not use the value –1 for fuFlags. That is because fuFlags is specified as (UINT) HIWORD(wParam). If HIWORD(wParam) were 0xFFFF, fuFlags (because of the UINT cast) would be 0x0000FFFF, not –1.

WM_MENUCHAR = H0120;
当菜单已被激活用户按下了某个键(不同于加速键),发送此消息给菜单的所有者;
The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu. 
WM_MENUCHAR 
chUser = (TCHAR) LOWORD(wParam); // character code
fuFlag = (UINT) HIWORD(wParam);  // menu flag 
hmenu = (HMENU) lParam;          // handle to menu  
Parameters
chUser 
Value of the low-order word of wParam. Specifies the character code that corresponds to the key the user pressed. 
fuFlag 
Value of the high-order word of wParam. Specifies the type of the active menu. This parameter can be one of the following values: Value Meaning 
MF_POPUP drop-down menu, submenu, or shortcut menu 
MF_SYSMENU window menu (System menu or Control menu) 
hmenu 
Value of lParam. Handle to the active menu. 
Return Values
An application that processes this message should return one of the following values in the high-order word of the return value: 
Value Meaning 
MNC_IGNORE Informs the system that it should discard the character the user pressed and create a short beep on the system speaker. 
MNC_CLOSE Informs the system that it should close the active menu. 
MNC_EXECUTE Informs the system that it should choose the item specified in the low-order word of the return value. The owner window receives a WM_COMMAND message. 
MNC_SELECT Informs the system that it should select the item specified in the low-order word of the return value.  
Remarks
The low-order word is ignored if the high-order word contains 0 or 1. An application should process this message when an accelerator is used to select a menu item that displays a bitmap.

WM_ENTERIDLE = H0121;
当一个模态对话框或菜单进入空载状态时发送此消息给它的所有者,一个模态对话框或菜单进入空载状态就是在处理完一条或几条先前的消息后没有消息它的列队中等待
The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages. 
WM_ENTERIDLE 
fuSource = wParam;    // idle-source flag 
hwnd = (HWND) lParam; // handle of dialog box or owner window  
Parameters
fuSource 
Value of wParam. Specifies whether the message is the result of a dialog box or a menu being displayed. This parameter can be one of the following values: Value Meaning 
MSGF_DIALOGBOX The system is idle because a dialog box is displayed. 
MSGF_MENU The system is idle because a menu is displayed. 
hwnd 
Value of lParam. Contains the handle of the dialog box (if fuSource is MSGF_DIALOGBOX) or of the window containing the displayed menu (if fuSource is MSGF_MENU). 
Return Values
An application should return zero if it processes this message. 
Remarks
You can suppress the WM_ENTERIDLE message for a dialog box by creating the dialog box with the DS_NOIDLEMSG style.

WM_MENURBUTTONUP = H0122;

WM_MENUDRAG = H0123;

WM_MENUGETOBJECT = H0124;

WM_UNINITMENUPOPUP = H0125;

WM_MENUCOMMAND = H0126;

WM_CHANGEUISTATE = H0127;

WM_UPDATEUISTATE = H0128;

WM_QUERYUISTATE = H0129;

WM_CTLCOLORMSGBOX = H0132;
在windows绘制消息框前发送此消息消息框的所有者窗口,通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置消息框的文本和背景颜色
The WM_CTLCOLORMSGBOX message is obsolete. It is included for compatibility with earlier versions of the system. Current versions of Windows and Windows NT do not send this message.

WM_CTLCOLOREDIT = H0133;
当一个编辑型控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置编辑框的文本和背景颜色
An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control. 
WM_CTLCOLOREDIT 
hdcEdit = (HDC) wParam;   // handle to display context 
hwndEdit = (HWND) lParam; // handle to static control  
Parameters
hdcEdit 
Value of wParam. Handle to the device context for the edit control window. 
hwndEdit 
Value of lParam. Handle to the edit control. 
Return Values
If an application processes this message, it must return the handle of a brush. The system uses the brush to paint the background of the edit control. 
Default Action
The DefWindowProc function selects the default system colors for the edit control. 
Remarks
Read-only or disabled edit controls do not send the WM_CTLCOLOREDIT message; instead, they send the WM_CTLCOLORSTATIC message. However, for compatibility purposes, the system sends the WM_CTLCOLOREDIT message for read-only and disabled edit controls if the application was designed for Windows 3.1 or earlier.
The system does not automatically destroy the returned brush. It is the application‘s responsibility to destroy the brush when it is no longer needed.
The WM_CTLCOLOREDIT message is never sent between threads, it is only sent within the same thread. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_CTLCOLORLISTBOX = H0134;
当一个列表框控件将要被绘制前发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置列表框的文本和背景颜色 
The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the given display device context handle. 
WM_CTLCOLORLISTBOX 
hdcLB = (HDC) wParam;   // handle to list box display context 
hwndLB = (HWND) lParam; // handle to list box  
Parameters
hdcLB 
Value of wParam. Handle to the device context for the list box. 
hwndLB 
Value of lParam. Handle to the list box. 
Return Values
If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the list box. 
Default Action
The DefWindowProc function selects the default system colors for the list box. 
Remarks
The system does not automatically destroy the returned brush. It is the application‘s responsibility to destroy the brush when it is no longer needed.
The WM_CTLCOLORLISTBOX message is never sent between threads. It is sent only within one thread. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_CTLCOLORBTN = H0135;
当一个按钮控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置按纽的文本和背景颜色
The WM_CTLCOLORBTN message is sent to the parent window of a button when the button is about to be drawn. By responding to this message, the parent window can set a button‘s text and background colors. 
WM_CTLCOLORBTN 
hdcButton = (HDC) wParam;   // handle to the button display context 
hwndButton = (HWND) lParam; // handle to the button  
Parameters
hdcButton 
Value of wParam. Handle to the display context for the button. 
hwndButton 
Value of lParam. Handle to the button. 
Return Values
If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the button. 
Default Action
The DefWindowProc function selects the default system colors for the button. 
Remarks
The system does not automatically destroy the returned brush. It is the application‘s responsibility to destroy the brush when it is no longer needed.
The WM_CTLCOLORBTN message is never sent between threads. It is sent only within one thread. 
The text color of a check box or radio button applies to the box or button, its check mark, and the text. The focus rectangle for these buttons remains the system default color (typically black). The text color of a group box applies to the text but not to the line that defines the box. The text color of a push button applies only to its focus rectangle; it does not affect the color of the text. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_CTLCOLORDLG = H0136;
当一个对话框控件将要被绘制前发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置对话框的文本背景颜色
The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors by using the given display device context handle. 
WM_CTLCOLORDLG 
hdcDlg = (HDC) wParam;   // handle of dialog box display context 
hwndDlg = (HWND) lParam; // handle of dialog box  
Parameters
hdcDlg 
Value of wParam. Identifies the device context for the dialog box. 
hwndDlg 
Value of lParam. Identifies the dialog box. 
Return Values
If an application processes this message, it must return the handle of a brush. The system uses the brush to paint the background of the dialog box. 
Default Action
The DefWindowProc function selects the default system colors for the dialog box. 
Remarks
The system does not automatically destroy the returned brush. It is the application‘s responsibility to destroy the brush when it is no longer needed.
The WM_CTLCOLORDLG message is never sent between threads. It is sent only within one thread. 
Note that the WM_CTLCOLORDLG message is sent to the dialog box itself; all of the other WM_CTLCOLOR* messages are sent to the owner of the control. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_CTLCOLORSCROLLBAR= H0137;
当一个滚动条控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置滚动条的背景颜色
The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the given display context handle to set the background color of the scroll bar control. 
WM_CTLCOLORSCROLLBAR 
hdcSB  = (HDC) wParam;   // handle to scroll-bar display context 
hwndSB = (HWND) lParam;  // handle to scroll bar 
Parameters
hdcSB 
Value of wParam. Handle to the device context for the scroll bar control. 
hwndSB 
Value of lParam. Handle to the scroll bar. 
Return Values
If an application processes this message, it must return the handle to a brush. The system uses the brush to paint the background of the scroll bar control. 
Default Action
The DefWindowProc function selects the default system colors for the scroll bar control. 
Remarks
The system does not automatically destroy the returned brush. It is the application‘s responsibility to destroy the brush when it is no longer needed.
The WM_CTLCOLORSCROLLBAR message is never sent between threads; it is only sent within the same thread. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_CTLCOLORSTATIC = H0138; 
当一个静态控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置静态控件的文本和背景颜色
A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control. 
WM_CTLCOLORSTATIC 
hdcStatic = (HDC) wParam;   // handle to display context 
hwndStatic = (HWND) lParam; // handle to static control  
Parameters
hdcStatic 
Value of wParam. Handle to the device context for the static control window. 
hwndStatic 
Value of lParam. Handle to the static control. 
Return Values
If an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control. 
Default Action
The DefWindowProc function selects the default system colors for the static control. 
Remarks
Edit controls that are not read-only or disabled do not send the WM_CTLCOLORSTATIC message; instead, they send the WM_CTLCOLOREDIT message. However, for compatibility purposes, the system sends the WM_CTLCOLOREDIT message for read-only and disabled edit controls if the application was designed for Windows 3.1 or earlier.
The system does not automatically destroy the returned brush. It is the application‘s responsibility to destroy the brush when it is no longer needed.
The WM_CTLCOLORSTATIC message is never sent between threads; it is sent only within the same thread. 
If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

WM_MOUSEFIRST = H0200;

WM_MOUSEMOVE = H0200; 
// 移动鼠标
The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_MOUSEMOVE 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor  
Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
Remarks
The MAKEPOINTS macro can be used to convert the lParam parameter to a POINTS structure.

WM_LBUTTONDOWN = H0201; 
//按下鼠标左键
The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_LBUTTONDOWN 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor 
 Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_LBUTTONUP = H0202; 
//释放鼠标左键
The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_LBUTTONUP 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor  
Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_LBUTTONDBLCLK = H0203;
//双击鼠标左键
The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_LBUTTONDBLCLK 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor 
 Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the left mouse button within the system‘s double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP again. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_RBUTTONDOWN = H0204;
//按下鼠标右键
The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_RBUTTONDOWN 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor 
 Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_RBUTTONUP = H0205;
//释放鼠标右键
The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_RBUTTONUP 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor  
Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_RBUTTONDBLCLK = H0206; 
//双击鼠标右键
The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_RBUTTONDBLCLK 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor 
 Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
Only windows that have the CS_DBLCLKS style can receive WM_RBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the right mouse button within the system‘s double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK, and WM_RBUTTONUP again. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_MBUTTONDOWN = H0207;
//按下鼠标中键
The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_MBUTTONDOWN
fwKeys = wParam;        // key flags
xPos = LOWORD(lParam);  // horizontal position of cursor
yPos = HIWORD(lParam);  // vertical position of cursor
 Parameters
fwKeys
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_MBUTTONUP = H0208; 
//释放鼠标中键
The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_MBUTTONUP 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor 
 Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_MBUTTONDBLCLK = H0209; 
//双击鼠标中键
The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
WM_MBUTTONDBLCLK 
fwKeys = wParam;        // key flags 
xPos = LOWORD(lParam);  // horizontal position of cursor 
yPos = HIWORD(lParam);  // vertical position of cursor 
Parameters
fwKeys 
Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
Return Values
If an application processes this message, it should return zero. 
Remarks
Only windows that have the CS_DBLCLKS style can receive WM_MBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the middle mouse button within the system‘s double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, and WM_MBUTTONUP again. 
An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

WM_MOUSEWHEEL = H020A;522
当鼠标轮子转动时发送此消息给当前有焦点的控件
The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window‘s parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
WM_MOUSEWHEEL
fwKeys = LOWORD(wParam);    // key flags
zDelta = (short) HIWORD(wParam);    // wheel rotation
xPos = (short) LOWORD(lParam);    // horizontal position of pointer
yPos = (short) HIWORD(lParam);    // vertical position of pointer 
Parameters
fwKeys 
Value of the low-order word of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
MK_CONTROL Set if the ctrl key is down. 
MK_LBUTTON Set if the left mouse button is down. 
MK_MBUTTON Set if the middle mouse button is down. 
MK_RBUTTON Set if the right mouse button is down. 
MK_SHIFT Set if the shift key is down. 
zDelta 
The value of the high-order word of wParam. Indicates the distance that the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. 
xPos 
Value of the low-order word of lParam. Specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen. 
yPos 
Value of the high-order word of lParam. Specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen. 
Remarks
The zDelta parameter will be a multiple of WHEEL_DELTA, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.
The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels in the future, including perhaps a freely-rotating wheel with no notches. The expectation is that such a device would send more messages per rotation, but with a smaller value in each message. To support this possibility, you should either add the incoming delta values until WHEEL_DELTA is reached (so for a given delta-rotation you get the same response), or scroll partial lines in response to the more frequent messages. You could also choose your scroll granularity and accumulate deltas until it is reached.

WM_MOUSELAST = H020A;

WM_PARENTNOTIFY = H0210;
当MDI子窗口被创建或被销毁,或用户按了一下鼠标键而光标在子窗口上时发送此消息给它的父窗口
The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place. 
WM_PARENTNOTIFY 
fwEvent = LOWORD(wParam);  // event flags 
idChild = HIWORD(wParam);  // identifier of child window 
lValue = lParam;           // child handle, or cursor coordinates  
Parameters
fwEvent 
Value of the low-order word of wParam. Specifies the event for which the parent is being notified. This parameter can be one of the following values: Value Meaning 
WM_CREATE The child window is being created. 
WM_DESTROY The child window is being destroyed. 
WM_LBUTTONDOWN The user has placed the cursor over the child window and has clicked the left mouse button. 
WM_MBUTTONDOWN The user has placed the cursor over the child window and has clicked the middle mouse button. 
WM_RBUTTONDOWN The user has placed the cursor over the child window and has clicked the right mouse button. 
idChild 
Value of the high-order word of wParam. If the fwEvent parameter is the WM_CREATE or WM_DESTROY value, idChild specifies the identifier of the child window. Otherwise, idChild is undefined. 
lValue 
Contains a handle to the child window, if the fwEvent parameter is the WM_CREATE or WM_DESTROY value; otherwise, lValue contains the x- and y-coordinates of the cursor. The x-coordinate is in the low-order word and the y-coordinate is in the high-order word. 
Return Values
If an application processes this message, it should return zero. 
Remarks
This message is also sent to all ancestor windows of the child window, including the top-level window.
All child windows, except those that have the WS_EX_NOPARENTNOTIFY extended window style, send this message to their parent windows. By default, child windows in a dialog box have the WS_EX_NOPARENTNOTIFY style, unless the CreateWindowEx function is called to create the child window without this style.

WM_ENTERMENULOOP = H0211;
发送此消息通知应用程序的主窗口that已经进入了菜单循环模式
The WM_ENTERMENULOOP message informs an application‘s main window procedure that a menu modal loop has been entered. 
WM_ENTERMENULOOP 
wParam = (BOOL) fIsTrackPopupMenu  // flags a shortcut menu 
lParam = 0 ;                       // not used; must be zero 
 Parameters
fIsTrackPopupMenu 
Specifies whether the window menu was entered using the TrackPopupMenu function. This parameter has a value of TRUE if the window menu was entered using TrackPopupMenu, and FALSE if it was not. 
Return Values
An application should return zero if it processes this message. 
Remarks
The DefWindowProc function returns zero.

WM_EXITMENULOOP = H0212;
发送此消息通知应用程序的主窗口that已退出了菜单循环模式
The WM_EXITMENULOOP message informs an application‘s main window procedure that a menu modal loop has been exited. 
WM_EXITLOOP 
wParam = (BOOL) fIsTrackPopupMenu    // flags a shortcut menu 
lParam = 0 ;                         // not used; must be zero 
Parameters
fIsTrackPopupMenu 
Specifies whether the menu involved is a shortcut menu. This parameter has a value of TRUE if it is a shortcut menu, FALSE if it isn‘t. 
Return Values
An application should return zero if it processes this message. 
Remarks
The DefWindowProc function returns zero.

WM_NEXTMENU = H0213;

WM_SIZING = 532;
当用户正在调整窗口大小时发送此消息给窗口;通过此消息应用程序可以监视窗口大小和位置也可以修改他们
The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.
fwSide = wParam;         // edge of window being sized 
lprc = (LPRECT) lParam;  // screen coordinates of drag rectangle  
Parameters
fwSide 
Value of wParam. Indicates which edge of the window is being sized. This parameter can be a combination of the following values: Value Meaning 
WMSZ_BOTTOM Bottom edge 
WMSZ_BOTTOMLEFT Bottom-left corner 
WMSZ_BOTTOMRIGHT Bottom-right corner 
WMSZ_LEFT Left edge 
WMSZ_RIGHT Right edge 
WMSZ_TOP Top edge 
WMSZ_TOPLEFT Top-left corner 
WMSZ_TOPRIGHT Top-right corner 
lprc 
Address of a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. 
Return Values
An application should return TRUE if it processes this message.

WM_CAPTURECHANGED = 533;
发送此消息给窗口当它失去捕获的鼠标时;
The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture. 
WM_CAPTURECHANGED 
hwndNewCapture = (HWND) lParam;    // handle of window to gain mouse capture  
Parameters
hwndNewCapture 
Value of lParam. Handle to the window that is gaining the mouse capture. 
Return Values
An application should return zero if it processes this message. 
Remarks
A window receives this message even if it calls ReleaseCapture itself. An application should not attempt to set the mouse capture in response to this message.
When it receives this message, a window should redraw itself, if necessary, to reflect the new mouse-capture state.

WM_MOVING = 534;
当用户在移动窗口时发送此消息,通过此消息应用程序可以监视窗口大小和位置也可以修改他们;
The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.
fwSide = wParam;           // edge of window to be moved 
lprc = (LPRECT) lParam;    // screen coordinates of drag rectangle  
Parameters
fwSide 
Value of wParam. Indicates which edge of the window is being moved. This parameter can be a combination of the following values: Value Meaning 
WMSZ_BOTTOM Bottom edge 
WMSZ_BOTTOMLEFT Bottom-left corner 
WMSZ_BOTTOMRIGHT Bottom-right corner 
WMSZ_LEFT Left edge 
WMSZ_RIGHT Right edge 
WMSZ_TOP Top edge 
WMSZ_TOPLEFT Top-left corner 
WMSZ_TOPRIGHT Top-right corner 
lprc 
Value of lParam. Address of aRECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. 
Return Values
An application should return TRUE if it processes this message.

WM_POWERBROADCAST = 536;
消息发送给应用程序来通知它有关电源管理事件;
The WM_POWERBROADCAST message is sent to an application to notify it of power-management events. 
dwPowerEvent = (DWORD) wParam;
dwData = (DWORD) lParam; 
Parameters
dwPowerEvent 
Event notification message. This parameter can be one of the following values. Value Meaning 
PBT_APMBATTERYLOW Battery power is low. 
PBT_APMOEMEVENT OEM-defined event occurred. 
PBT_APMPOWERSTATUSCHANGE Power status has changed. 
PBT_APMQUERYSUSPEND Request for permission to suspend. 
PBT_APMQUERYSUSPENDFAILED Suspension request denied. 
PBT_APMRESUMEAUTOMATIC Operation resuming automatically after event. 
PBT_APMRESUMECRITICAL Operation resuming after critical suspension. 
PBT_APMRESUMESUSPEND Operation resuming after suspension. 
PBT_APMSUSPEND System is suspending operation. 
dwData 
Function-specific data. For most messages, this parameter is reserved and not used. 
However, if wParam is one of the resume notifications (PBT_APMRESUME*), the lParam parameter can specify the PBTF_APMRESUMEFROMFAILURE flag. This flag indicates that a suspend operation failed after the PBT_APMSUSPEND message was sent. 
Return Values
Return TRUE to grant a request.
Return BROADCAST_QUERY_DENY to deny a request.

WM_DEVICECHANGE = 537;
当设备的硬件配置改变时发送此消息给应用程序或设备驱动程序
The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer.
Event = (UINT) wParam;
dwData = (DWORD) lParam; 
Parameters
Event 
Event type. This parameter can be one of the following values: Value Meaning 
DBT_CONFIGCHANGECANCELED  A request to change the current configuration (dock or undock) has been canceled. 
DBT_CONFIGCHANGED The current configuration has changed, due to a dock or undock.  
DBT_DEVICEARRIVAL A device has been inserted and is now available.  
DBT_DEVICEQUERYREMOVE Permission is requested to remove a device. Any application can deny this request and cancel the removal. 
DBT_DEVICEQUERYREMOVEFAILED A request to remove a device has been canceled. 
DBT_DEVICEREMOVECOMPLETE A device has been removed. 
DBT_DEVICEREMOVEPENDING A device is about to be removed. Cannot be denied. 
DBT_DEVICETYPESPECIFIC A device-specific event has occurred. 
DBT_QUERYCHANGECONFIG  Permission is requested to change the current configuration (dock or undock).  
DBT_USERDEFINED  The meaning of this message is user-defined. 
dwData 
Address of a structure that contains event-specific data. Its meaning depends on the given event. 
Return Values
Return TRUE to grant a requested action.
Return BROADCAST_QUERY_DENY to deny a requested action.
Remarks
For devices that offer software-controllable features, such as ejection and locking, the system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully. 
If the system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so.
DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED

WM_IME_STARTCOMPOSITION = H010D;

WM_IME_ENDCOMPOSITION = H010E;

WM_IME_COMPOSITION = H010F;

WM_IME_KEYLAST = H010F;

WM_IME_SETCONTEXT = H0281;

WM_IME_NOTIFY = H0282;

WM_IME_CONTROL = H0283;

WM_IME_COMPOSITIONFULL = H0284;

WM_IME_SELECT = H0285;

WM_IME_CHAR = H0286;

WM_IME_REQUEST = H0288;

WM_IME_KEYDOWN = H0290;

WM_IME_KEYUP = H0291;

WM_MDICREATE = H0220;
应用程序发送此消息给多文档的客户窗口来创建一个MDI 子窗口
An application sends the WM_MDICREATE message to a multiple document interface (MDI) client window to create an MDI child window. 
WM_MDICREATE 
wParam = 0;                                     // not used; must be zero 
lParam = (LPARAM) (LPMDICREATESTRUCT) lpmdic;   // creation data  
Parameters
lpmdic 
Pointer to an MDICREATESTRUCT structure containing information that the system uses to create the MDI child window. 
Return Values
If the message succeeds, the return value is the handle to the new child window.
If the message fails, the return value is NULL. 
Remarks
The MDI child window is created with the style bits WS_CHILD, WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_SYSMENU, WS_CAPTION, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX, plus additional style bits specified in the MDICREATESTRUCT structure to which the lpmdic parameter points. The system adds the title of the new child window to the Window menu of the frame window. An application should use this message to create all child windows of the client window. 
If an MDI client window receives any message that changes the activation of its child windows while the active child window is maximized, the system restores the active child window and maximizes the newly activated child window. 
When an MDI child window is created, the system sends the WM_CREATE message to the window. The lParam parameter of the WM_CREATE message contains a pointer to a CREATESTRUCT structure. The lpCreateParams member of this structure contains a pointer to the MDICREATESTRUCT structure passed with the WM_MDICREATE message that created the MDI child window. 
An application should not send a second WM_MDICREATE message while a WM_MDICREATE message is still being processed. For example, it should not send a WM_MDICREATE message while an MDI child window is processing its WM_MDICREATE message.

WM_MDIDESTROY = H0221;
应用程序发送此消息给多文档的客户窗口来关闭一个MDI 子窗口
An application sends the WM_MDIDESTROY message to a multiple document interface (MDI) client window to close an MDI child window. 
WM_MDIDESTROY 
wParam = (WPARAM) (HWND) hwndChild; // handle to child to close 
lParam = 0;                         // not used; must be zero  
Parameters
hwndChild 
Value of wParam. Handle to the MDI child window to be closed. 
Return Values
This message always returns zero. 
Remarks
This message removes the title of the MDI child window from the MDI frame window and deactivates the child window. An application should use this message to close all MDI child windows. 
If an MDI client window receives a message that changes the activation of its child windows and the active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

WM_MDIACTIVATE = H0222;
应用程序发送此消息给多文档的客户窗口通知客户窗口激活另一个MDI子窗口,当客户窗口收到此消息后,它发出WM_MDIACTIVE消息给MDI子窗口(未激活)激活它;
An application sends the WM_MDIACTIVATE message to a multiple document interface (MDI) client window to instruct the client window to activate a different MDI child window. As the client window processes this message, it sends WM_MDIACTIVATE to the child window being deactivated and to the child window being activated. 
WM_MDIACTIVATE 
// Message sent to MDI client 
wParam = (WPARAM) (HWND) hwndChildAct; // child to activate 
lParam = 0;                            // not used; must be zero  
// Message received by MDI child 
hwndChildDeact = (HWND) wParam;        // child being deactivated 
hwndChildAct = (HWND) lParam;          // child being activated  
Parameters
In messages sent to an MDI client window: 
hwndChildAct 
Value of wParam. Handle to the MDI child window to be activated. 
In messages received by an MDI child window: 
hwndChildDeact 
Value of wParam. Handle to the MDI child window being deactivated. 
hwndChildAct 
Value of lParam. Handle to the MDI child window being activated. 
Return Values
If an application sends this message to an MDI client window, the return value is zero. An MDI child window should return zero if it processes this message. 
Remarks
An MDI child window is activated independently of the MDI frame window. When the frame window becomes active, the child window last activated by using the WM_MDIACTIVATE message receives the WM_NCACTIVATE message to draw an active window frame and title bar; the child window does not receive another WM_MDIACTIVATE message.

WM_MDIRESTORE = H0223;
程序 发送此消息给MDI客户窗口让子窗口从最大最小化恢复到原来大小
An application sends the WM_MDIRESTORE message to a multiple document interface (MDI) client window to restore an MDI child window from maximized or minimized size. 
WM_MDIRESTORE 
wParam = (WPARAM) (HWND) hwndRes; // handle to child to restore 
lParam = 0;                       // not used; must be zero  
Parameters
hwndRes 
Value of wParam. Handle to the MDI child window to be restored. 
Return Values
The return value is always zero.

WM_MDINEXT = H0224;
程序 发送此消息给MDI客户窗口激活下一个或前一个窗口
An application sends the WM_MDINEXT message to a multiple document interface (MDI) client window to activate the next or previous child window. 
WM_MDINEXT 
wParam = (WPARAM) (HWND) hwndChild; // handle to child 
lParam = (LPARAM) fNext;            // next or previous child  
Parameters
hwndChild 
Value of wParam. Handle to the MDI child window. The system activates the child window that is immediately before or after the given child window, depending on the value of the fNext parameter. If the hwndChild parameter is NULL, the system activates the child window that is immediately before or after the currently active child window. 
fNext 
Value of lParam. If this parameter is zero, the system activates the next MDI child window and places the child window identified by the hwndChild parameter behind all other child windows. If this parameter is nonzero, the system activates the previous child window, placing it in front of the child window identified by hwndChild. 
Return Values
The return value is always zero. 
Remarks
If an MDI client window receives any message that changes the activation of its child windows while the active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

WM_MDIMAXIMIZE = H0225;
程序发送此消息给MDI客户窗口来最大化一个MDI子窗口;
An application sends the WM_MDIMAXIMIZE message to a multiple document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window‘s window menu icon in the rightmost position of the frame window‘s menu bar, and places the child window‘s restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window. 
WM_MDIMAXIMIZE 
wParam = (WPARAM) (HWND) hwndMax; // handle to child to maximize 
lParam = 0;                       // not used; must be zero  
Parameters
hwndMax 
Value of wParam. Handle to the MDI child window to be maximized. 
Return Values
The return value is always zero. 
Remarks
If an MDI client window receives any message that changes the activation of its child windows while the currently active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

WM_MDITILE = H0226;
程序 发送此消息给MDI客户窗口以平铺方式重新排列所有MDI子窗口
An application sends the WM_MDITILE message to a multiple document interface (MDI) client window to arrange all of its MDI child windows in a tile format. 
WM_MDITILE 
wParam = (WPARAM) (UINT) fuTile; // tiling flag 
lParam = 0;                      // not used; must be zero  
Parameters
fuTile 
Specifies a tiling flag. This parameter can be one of the following values: Value Meaning 
MDITILE_HORIZONTAL Tiles MDI child windows so that they are wide rather than tall. 
MDITILE_SKIPDISABLED Prevents disabled MDI child windows from being tiled. 
MDITILE_VERTICAL Tiles MDI child windows so that they are tall rather than wide. 
Return Values
If the message succeeds, the return value is TRUE.
If the message fails, the return value is FALSE.

WM_MDICASCADE = H0227;
程序 发送此消息给MDI客户窗口以层叠方式重新排列所有MDI子窗口
An application sends the WM_MDICASCADE message to a multiple document interface (MDI) client window to arrange all its child windows in a cascade format. 
WM_MDICASCADE 
wParam = (WPARAM) (UINT) fuCascade;  // cascade flag 
lParam = 0;                          // not used; must be zero  
Parameters
fuCascade 
Value of wParam. Specifies a cascade flag. The only flag currently available, MDITILE_SKIPDISABLED, prevents disabled MDI child windows from being cascaded. 
Return Values
If the message succeeds, the return value is TRUE.
If the message fails, the return value is FALSE.

WM_MDIICONARRANGE = H0228;
程序 发送此消息给MDI客户窗口重新排列所有最小化的MDI子窗口
An application sends the WM_MDIICONARRANGE message to a multiple document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized. 
WM_MDIICONARRANGE 
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero 
 Parameters
This message has no parameters.

WM_MDIGETACTIVE = H0229;
程序 发送此消息给MDI客户窗口来找到激活的子窗口的句柄
An application sends the WM_MDIGETACTIVE message to a multiple document interface (MDI) client window to retrieve the handle to the active MDI child window. 
WM_MDIGETACTIVE 
wParam = 0;                      // not used; must be zero 
lParam = (LPBOOL) lpfMaximized;  // optional pointer to maximized state flag  
Parameters
lpfMaximized 
Value of lparam. This is an optional pointer to a maximized state flag variable. If lpfMaximized is non-NULL, the BOOL it points to is set to indicate the maximized state of the MDI child window. TRUE indicates that the window is maximized, FALSE indicates that it is not. This is equivalent to the indication supplied by the high-order word of the return value of the WM_MDIGETACTIVE message under 16-bit Windows. If lpfMaximized is NULL, the parameter is ignored. 
Return Values
The return value is the handle to the active MDI child window. 
Remarks
Note carefully a change in how this message indicates maximization. In 16-bit Windows, the message return value includes a flag indicating whether the MDI child window is maximized. In the Win32 API, the return value does not include this flag. Instead, the MDI child window‘s maximized state is indicated by setting a BOOL variable via the optional parameter in lParam, lpfMaximized.

WM_MDISETMENU = H0230;
程序 发送此消息给MDI客户窗口用MDI菜单代替子窗口的菜单
An application sends the WM_MDISETMENU message to a multiple document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the Window menu of the frame window, or both. 
WM_MDISETMENU 
wParam = (WPARAM) (HMENU) hmenuFrame;  // handle to frame menu 
lParam = (LPARAM) (HMENU) hmenuWindow; // handle to Window menu  
Parameters
hmenuFrame 
Value of wParam. Handle to the new frame window menu. If this parameter is NULL, the frame window menu is not changed. 
hmenuWindow 
Value of lParam. Handle to the new Window menu. If this parameter is NULL, the Window menu is not changed. 
Return Values
If the message succeeds, the return value is the handle to the old frame window menu.
If the message fails, the return value is zero. 
Remarks
After sending this message, an application must call the DrawMenuBar function to update the menu bar. 
If this message replaces the Window menu, the MDI child window menu items are removed from the previous Window menu and added to the new Window menu. 
If an MDI child window is maximized and this message replaces the MDI frame window menu, the window menu icon and restore icon are removed from the previous frame window menu and added to the new frame window menu.

WM_ENTERSIZEMOVE = H0231;
The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window‘s title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled. 
WM_ENTERSIZEMOVE 
wParam = 0;  // not used, must be zero 
lParam = 0;  // not used, must be zero  
Parameters
This message has no parameters. 
Return Values
An application should return zero if it processes this message.

WM_EXITSIZEMOVE = H0232;
The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window‘s title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
WM_EXITSIZEMOVE 
wParam = 0;  // not used; must be zero 
lParam = 0;  // not used; must be zero  
Parameters
This message has no parameters. 
Return Values
An application should return zero if it processes this message.

WM_DROPFILES = H0233;D0563
Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files. 
Syntax 
WM_DROPFILES 
    hDrop = (HANDLE) wParam; 
Return Values 
An application should return zero if it processes this message. 
Parameters 
hDrop 
Handle to an internal structure describing the dropped files. This handle is used by the DragFinish, DragQueryFile, and DragQueryPoint functions to retrieve information about the dropped files.

WM_MDIREFRESHMENU = H0234;
An application sends the WM_MDIREFRESHMENU message to a multiple document interface (MDI) client window to refresh the Window menu of the MDI frame window. 
WM_MDIREFRESHMENU 
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero  
Parameters
This message has no parameters. 
Return Values
If the message succeeds, the return value is the handle to the frame window menu.
If the message fails, the return value is NULL. 
Remarks
After sending this message, an application must call the DrawMenuBar function to update the menu bar.

WM_MOUSEHOVER = H02A1;

WM_MOUSELEAVE = H02A3;

WM_CUT = H0300 : D768
程序发送此消息给一个编辑框或combobox来删除当前选择的文本
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero 
This message does not return a value.

WM_COPY = H0301 : D769
程序发送此消息给一个编辑框或combobox来复制当前选择的文本到剪贴板
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero 
This message does not return a value.

WM_PASTE = H0302 : D770
程序发送此消息给editcontrol或combobox从剪贴板中得到数据
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero 
This message does not return a value.

WM_CLEAR = H0303 : D771
程序发送此消息给editcontrol或combobox清除当前选择的内容;
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero 
This message does not return a value.

WM_UNDO = H0304 : D772
程序发送此消息给editcontrol或combobox撤消最后一次操作
wParam = 0; // not used; must be zero 
lParam = 0; // not used; must be zero

WM_RENDERFORMAT = H0305 : D773
The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function. 
WM_RENDERFORMAT 
uFormat = (UINT) wParam;    // clipboard format  
Parameters
uFormat 
Specifies the clipboard format to be rendered. 
Return Values
If an application processes this message, it should return zero. 
Remarks
When responding to a WM_RENDERFORMAT message, the clipboard owner must not open the clipboard before calling SetClipboardData.

WM_RENDERALLFORMATS = H0306 : D774
The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function. 
WM_RENDERALLFORMATS  
Parameters
This message has no parameters. 
Return Values
If an application processes this message, it should return zero. 
Remarks
When responding to a WM_RENDERALLFORMATS message, the clipboard owner must call the OpenClipboard and EmptyClipboard functions before calling SetClipboardData. 
When the application returns, the system removes any unrendered formats from the list of available clipboard formats. For information about delayed rendering, see SetClipboardData.

WM_DESTROYCLIPBOARD = H0307 : D775
当调用ENPTYCLIPBOARD函数时 发送此消息给剪贴板的所有者
The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard. 
WM_DESTROYCLIPBOARD  
Parameters
This message has no parameters. 
Return Values
If an application processes this message, it should return zero.

WM_DRAWCLIPBOARD = H0308 : D776
当剪贴板的内容变化时发送此消息给剪贴板观察链的第一个窗口;它允许用剪贴板观察窗口来显示剪贴板的新内容;
The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard. 
WM_DRAWCLIPBOARD  
Parameters
This message has no parameters. 
Remarks
Only clipboard viewer windows receive this message. These are windows that have been added to the clipboard viewer chain by using the SetClipboardViewer function. 
Each window that receives the WM_DRAWCLIPBOARD message must call the SendMessage function to pass the message on to the next window in the clipboard viewer chain. The handle of the next window in the chain is returned by SetClipboardViewer, and may change in response to a WM_CHANGECBCHAIN message.

WM_PAINTCLIPBOARD = H0309 : D777
当剪贴板包含CF_OWNERDIPLAY格式的数据并且剪贴板观察窗口的客户区需要重画;
The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer‘s client area needs repainting. 
WM_PAINTCLIPBOARD 
hwndViewer = (HWND) wParam;     // handle of clipboard viewer window 
hglbPs = (HGLOBAL) lParam;      // handle of PAINTSTRUCT object  
Parameters
hwndViewer 
Value of wParam. Handle to the clipboard viewer window. 
hglbPs 
Value of lParam. Handle to a global DDESHARE object that contains aPAINTSTRUCT structure. The structure defines the part of the client area to paint. 
Return Values
If an application processes this message, it should return zero. 
Remarks
To determine whether the entire client area or just a portion of it needs repainting, the clipboard owner must compare the dimensions of the drawing area given in the rcpaint member of PAINTSTRUCT to the dimensions given in the most recent WM_SIZECLIPBOARD message. 
The clipboard owner must use the GlobalLock function to lock the memory that contains the PAINTSTRUCT structure. Before returning, the clipboard owner must unlock that memory by using the GlobalUnlock function.

WM_VSCROLLCLIPBOARD = H030A : D778
The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer‘s vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
WM_VSCROLLCLIPBOARD 
hwndViewer = (HWND) wParam;         // handle of clipboard viewer window 
nScrollCode = (int) LOWORD(lParam); // scroll bar code 
nPos = (int) HIWORD(lParam);        // scroll box position  
Parameters
hwndViewer 
Value of wParam. Handle to the clipboard viewer window. 
nScrollCode 
Value of the low-order word of lParam. Specifies a scroll bar event. This parameter can be one of the following values: Value Meaning 
SB_BOTTOM Scroll to lower right. 
SB_ENDSCROLL End scroll. 
SB_LINEDOWN Scroll one line down. 
SB_LINEUP Scroll one line up. 
SB_PAGEDOWN Scroll one page down. 
SB_PAGEUP Scroll one page up. 
SB_THUMBPOSITION Scroll to absolute position. The current position is specified by the nPos parameter. 
SB_TOP Scroll to upper left. 
nPos 
Value of the high-order word of lParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION; otherwise, the nPos parameter is not used. 
Return Values
If an application processes this message, it should return zero.

WM_SIZECLIPBOARD = H030B : D779
当剪贴板包含CF_OWNERDIPLAY格式的数据并且剪贴板观察窗口的客户区域的大小已经改变是此消息通过剪贴板观察窗口发送给剪贴板的所有者;
The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer‘s client area has changed size. 
WM_SIZECLIPBOARD 
hwndViewer = (HWND) wParam;  // handle of clipboard viewer window 
hglbRc = (HGLOBAL) lParam;   // handle of RECT object  
Parameters
hwndViewer 
Value of wParam. Handle to the clipboard viewer window. 
hglbRc 
Value of lParam. Handle to a global memory object that contains aRECT structure. The structure specifies the new dimensions of the clipboard viewer‘s client area. 
Remarks
When the clipboard viewer window is about to be destroyed or resized, a WM_SIZECLIPBOARD message is sent with a null rectangle (0, 0, 0, 0) as the new size. This permits the clipboard owner to free its display resources. 
The clipboard owner must use the GlobalLock function to lock the memory object that contains RECT. Before returning, the clipboard owner must unlock the object by using the GlobalUnlock function.

WM_ASKCBFORMATNAME = H030C;
通过剪贴板观察窗口发送此消息给剪贴板的所有者来请求一个CF_OWNERDISPLAY格式的剪贴板的名字
The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format. 
WM_ASKCBFORMATNAME 
cchName = (DWORD) wParam            // size of buffer 
lpszFormatName = (LPTSTR) lParam    // buffer to receive format name  
Parameters
cchName 
Value of wParam. Specifies the size, in characters, of the buffer pointed to by the lpszFormatName parameter. 
lpszFormatName 
Value of lParam. Pointer to the buffer that is to receive the clipboard format name. 
Return Values
If an application processes this message, it should return zero. 
Remarks
In response to this message, the clipboard owner should copy the name of the owner-display format to the specified buffer, not exceeding the buffer size specified by the cchName parameter. 
A clipboard viewer window sends this message to the clipboard owner to determine the name of the CF_OWNERDISPLAY format — for example, to initialize a menu listing available formats.

WM_CHANGECBCHAIN = H030D;
当一个窗口从剪贴板观察链中移去时发送此消息给剪贴板观察链的第一个窗口;
The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain. 
WM_CHANGECBCHAIN 
hwndRemove = (HWND) wParam;     // handle of window being removed 
hwndNext = (HWND) lParam;       // handle of next window in chain  
Parameters
hwndRemove 
Value of wParam. Handle to the window being removed from the clipboard viewer chain. 
hwndNext 
Value of lParam. Handle to the next window in the chain following the window being removed. This parameter is NULL if the window being removed is the last window in the chain. 
Return Values
If an application processes this message, it should return zero. 
Remarks
Each clipboard viewer window saves the handle of the next window in the clipboard viewer chain. Initially, this handle is the return value of the SetClipboardViewer function. 
When a clipboard viewer window receives the WM_CHANGECBCHAIN message, it should call theSendMessage function to pass the message to the next window in the chain, unless the next window is the window being removed. In this case, the clipboard viewer should save the handle specified by hwndNext as the next window in the chain.

WM_HSCROLLCLIPBOARD = H030E; 
消息通过一个剪贴板观察窗口发送给剪贴板的所有者 ;它发生在当剪贴板包含CFOWNERDISPALY格式的数据并且有个事件在剪贴板观察窗的水平滚动条上;所有者应滚动剪贴板图象并更新滚动条的值;
The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer‘s horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
WM_HSCROLLCLIPBOARD 
hwndViewer = (HWND) wParam;         // handle of clipboard viewer window 
nScrollCode = (int) LOWORD(lParam); // scroll bar code 
nPos = (int) HIWORD(lParam);        // scroll box position 
 Parameters
hwndViewer 
Value of wParam. Handle to the clipboard viewer window. 
nScrollCode 
Value of the low-order word of lParam. Specifies a scroll bar event. This parameter can be one of the following values: Value Meaning 
SB_ENDSCROLL End scroll. 
SB_LEFT Scroll to upper left. 
SB_RIGHT Scroll to lower right. 
SB_LINELEFT Scrolls left by one unit. 
SB_LINERIGHT Scrolls right by one unit. 
SB_PAGELEFT Scrolls left by the width of the window. 
SB_PAGERIGHT Scrolls right by the width of the window. 
SB_THUMBPOSITION Scroll to absolute position. The current position is specified by the nPos parameter. 
nPos 
Value of the high-order word of lParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION; otherwise, the nPos parameter is not used. 
Return Values
If an application processes this message, it should return zero. 
Remarks
The clipboard owner can use the ScrollWindow function to scroll the image in the clipboard viewer window and invalidate the appropriate region.

WM_QUERYNEWPALETTE = H030F;
消息发送给将要收到焦点的窗口,此消息能使窗口在收到焦点时同时有机会实现他的逻辑调色板
The WM_QUERYNEWPALETTE message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus. 
WM_QUERYNEWPALETTE  
Parameters
This message has no parameters. 
Return Values
If the window realizes its logical palette, it must return TRUE; otherwise, it must return FALSE.

WM_PALETTEISCHANGING= H0310;
当一个应用程序正要实现它的逻辑调色板时发此消息通知所有的应用程序
The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette. 
WM_PALETTEISCHANGING 
hwndRealize = (HWND) wParam; // window to realize palette 
 Parameters
hwndRealize 
Value of wParam. Handle to the window that is going to realize its logical palette. 
Return Values
If an application processes this message, it should return zero. 
Remarks
The application changing its palette does not wait for acknowledgment of this message before changing the palette and sending the WM_PALETTECHANGED message. As a result, the palette may already be changed by the time an application receives this message. 
If the application either ignores or fails to process this message and a second application realizes its palette while the first is using palette indexes, there is a strong possibility that the user will see unexpected colors during subsequent drawing operations.

WM_PALETTECHANGED = H0311;
消息在一个拥有焦点的窗口实现它的逻辑调色板后发送此消息给所有顶级并重叠的窗口,以此来改变系统调色板 
The WM_PALETTECHANGED message is sent to all top-level and overlapped windows after the window with the keyboard focus has realized its logical palette, thereby changing the system palette. This message enables a window that uses a color palette but does not have the keyboard focus to realize its logical palette and update its client area. 
WM_PALETTECHANGED 
hwndPalChg = (HWND) wParam; // handle of window that changed palette  
Parameters
hwndPalChg 
Value of wParam. Handle to the window that caused the system palette to change. 
Remarks
This message must be sent to all top-level and overlapped windows, including the one that changed the system palette. If any child windows use a color palette, this message must be passed on to them as well. 
To avoid creating an infinite loop, a window that receives this message must not realize its palette, unless it determines that wParam does not contain its own window handle.

WM_HOTKEY = H0312;
当用户按下由REGISTERHOTKEY函数注册的热键时提交此消息
The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key. 
WM_HOTKEY 
idHotKey = (int) wParam;              // identifier of hot key 
fuModifiers = (UINT) LOWORD(lParam);  // key-modifier flags 
uVirtKey = (UINT) HIWORD(lParam);     // virtual-key code 
 Parameters
idHotKey 
Value of wParam. Specifies the identifier of the hot key that generated the message. If the message was generated by a system-defined hot key, the idHotKey parameter will be one of the following values. Value Meaning 
IDHOT_SNAPDESKTOP The "snap desktop" hot key was pressed. 
IDHOT_SNAPWINDOW The "snap window" hot key was pressed. 
fuModifiers 
Specifies the keys that were to be pressed in combination with the key specified by the nVirtKey parameter to generate the WM_HOTKEY message. The fuModifiers parameter can be a combination of the following values. Value Meaning 
MOD_ALT Either ALT key was held down. 
MOD_CONTROL Either CTRL key was held down. 
MOD_SHIFT Either SHIFT key was held down. 
MOD_WIN Either WINDOWS key was held down. These keys are labeled with the Microsoft Windows logo. 
uVirtKey 
Specifies the virtual key code of the hot key. 
Remarks
WM_HOTKEY is unrelated to the WM_GETHOTKEY and WM_SETHOTKEY hot keys. The WM_HOTKEY message is sent for generic hot keys while the WM_SET/GETHOTKEY messages relate to window activation hot keys.

WM_PRINT = 791;
应用程序发送此消息仅当WINDOWS或其它应用程序发出一个请求要求绘制一个应用程序的一部分;
The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.
WM_PRINT 
hdc = (HDC) wParam; 
uFlags = lParam;  
Parameters
hdc 
Handle to the device context to draw in. 
uFlags 
Specifies the drawing options. This parameter can be one or more of these flags. Value Meaning 
PRF_CHECKVISIBLE Draw the window only if it is visible. 
PRF_CHILDREN Draw all visible children windows. 
PRF_CLIENT Draw the client area of the window. 
PRF_ERASEBKGND Erase the background before drawing the window. 
PRF_NONCLIENT Draw the nonclient area of the window. 
PRF_OWNED Draw all owned windows. 
Remarks
TheDefWindowProc function processes this message based on which drawing option is specified: if PRF_CHECKVISIBLE is specified and the window is not visible, do nothing, if PRF_NONCLIENT is specified, draw the nonclient area in the given device context, if PRF_ERASEBKGND is specified, send the window a WM_ERASEBKGND message, if PRF_PRINTCLIENT is specified, send the window a WM_PRINTCLIENT message, if PRF_PRINTCHILDREN is set, send each visible child window a WM_PRINT message, if PRF_OWNED is set, send each visible owned window a WM_PRINT message.

WM_PRINTCLIENT = 792;
The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.
WM_PRINTCLIENT 
hdc = (HDC) wParam; 
uFlags = lParam;  
Parameters
hdc 
Handle to the device context to draw in. 
uFlags 
Specifies drawing options. This parameter can be one or more of these flags. Value Meaning 
PRF_CHECKVISIBLE Draw the window only if it is visible. 
PRF_CHILDREN Draw all visible children windows. 
PRF_CLIENT Draw the client area of the window. 
PRF_ERASEBKGND Erase the background before drawing the window. 
PRF_NONCLIENT Draw the nonclient area of the window. 
PRF_OWNED Draw all owned windows. 
Remarks
A window can process this message in much the same manner as WM_PAINT, except that BeginPaint and EndPaint need not be called (a device context is provided), and the window should draw its entire client area rather than just the invalid region.
Windows that can be used anywhere in the system, such as controls, should process this message. It is probably worthwhile for other windows to process this message as well because it is relatively easy to implement.

WM_HANDHELDFIRST = 856;

WM_HANDHELDLAST = 863;

WM_PENWINFIRST = H0380;

WM_PENWINLAST = H038F;

WM_COALESCE_FIRST = H0390;

WM_COALESCE_LAST = H039F;

WM_DDE_FIRST = H03E0;

WM_DDE_INITIATE = WM_DDE_FIRST + 0;
一个DDE客户程序提交此消息开始一个与服务器程序的会话来响应那个指定的程序和主题名;
A DDE client application sends a WM_DDE_INITIATE message to initiate a conversation with a server application responding to the specified application and topic names. Upon receiving this message, all server applications with names that match the specified application and that support the specified topic are expected to acknowledge it. (For more information, see the WM_DDE_ACK message.)
WM_DDE_INITIATE 
wParam = (WPARAM) hwnd;             // handle of posting appl. 
lParam = MAKELPARAM(aApp, aTopic);  // appl. and topic atoms  
Parameters
hwnd 
Value of wParam. Handle to the client window sending the message. 
aApp 
Value of the low-order word of lParam. Contains an atom that identifies the application with which a conversation is requested. The application name cannot contain slashes (/) or backslashes (/). These characters are reserved for network implementations. If aApp is NULL, a conversation with all applications is requested. 
aTopic 
Value of the high-order word of lParam. Contains an atom that identifies the topic for which a conversation is requested. If the topic is NULL, conversations for all available topics are requested. 
Remarks
If aApp is NULL, any server application can respond. If aTopic is NULL, any topic is valid. Upon receiving a WM_DDE_INITIATE request with the aTopic parameter set to NULL, a server must send a WM_DDE_ACK message for each of the topics it supports. 
Sending 
The client application sends WM_DDE_INITIATE by calling theSendMessage function, not thePostMessage function. The client broadcasts the message to all top-level windows by setting the first parameter of SendMessage to –1. 
If the client application has already obtained the window handle of the desired server, it can send WM_DDE_INITIATE directly to the server window by passing the server‘s window handle as the first parameter of SendMessage. 
The client application allocates aApp and aTopic by calling GlobalAddAtom. 
When SendMessage returns, the client application must delete the aApp and aTopic atoms. 
Receiving 
To complete the initiation of a conversation, the server application must respond with one or more WM_DDE_ACK messages, where each message is for a separate topic. When sending WM_DDE_ACK message, the server should create new aApp and aTopic atoms; it should not reuse the atoms sent with WM_DDE_INITIATE.

WM_DDE_TERMINATE = WM_DDE_FIRST + 1;
一个DDE应用程序(无论是客户还是服务器)提交此消息来终止一个会话;
A DDE application (client or server) posts a WM_DDE_TERMINATE message to terminate a conversation. 
WM_DDE_TERMINATE 
wParam = (WPARAM) hwnd; // handle of posting window 
lParam = 0;             // not used, must be zero  
Parameters
hwnd 
Value of wParam. Handle to the client or server window posting the message. 
Remarks
Posting 
The client or server application posts the WM_DDE_TERMINATE message by calling thePostMessage function, not theSendMessage function. 
While waiting for confirmation of the termination, the posting application should not post any other messages to the receiving application. If the sending application receives messages (other than WM_DDE_TERMINATE) from the receiving application, it should delete any atoms or shared memory objects accompanying the messages, except hData objects associated with WM_DDE_POKE or WM_DDE_DATA messages that do not have the fRelease flag set. 
Receiving 
The client or server application should respond by posting a WM_DDE_TERMINATE message.

WM_DDE_ADVISE = WM_DDE_FIRST + 2;
一个DDE客户程序提交此消息给一个DDE服务程序来请求服务器每当数据项改变时更新它
A DDE client application posts the WM_DDE_ADVISE message to a DDE server application to request the server to supply an update for a data item whenever the item changes. 
WM_DDE_ADVISE 
wParam = (WPARAM) hwnd;        // handle of posting application 
lParam = (LPARAM) lPackedVal;  // packed DDEADVISE and item atom  
Parameters
hwnd 
Value of wParam. Handle to the client window posting the message. 
lPackedVal 
Value of lParam. The component parameters packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hOptions. The high-order word is aItem. Parameter Description 
hOptions Handle to a global memory object containing a DDEADVISE structure that specifies how the data is to be sent.  
aItem Contains an atom that identifies the requested data item. 
Remarks
If a client application supports more than one clipboard format for a single topic and item, it can post multiple WM_DDE_ADVISE messages for the topic and item, specifying a different clipboard format with each message. Note that a server can support multiple formats only for hot data links, not warm data links. 
Posting 
The client application posts the WM_DDE_ADVISE message by calling thePostMessage function, not theSendMessage function. 
The client application allocates hOptions by calling the GlobalAlloc function with the GMEM_DDESHARE option. It allocates aItem by calling the GlobalAddAtom function. 
The client application must create or reuse the WM_DDE_ADVISE lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hOptions supplied as the low-order word and aItem supplied as the high-order word. 
If the receiving (server) application responds with a negative WM_DDE_ACK message, the posting (client) application must delete the hOptions object. 
The fRelease flag is not used in WM_DDE_ADVISE messages, but their data-freeing behavior is similar to that of WM_DDE_DATA and WM_DDE_POKE messages where fRelease is TRUE. 
Receiving 
The server application posts the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the application can reuse the aItem atom or delete it and create a new one. If the WM_DDE_ACK message is positive, the application should delete the hOptions object; otherwise, the application should not delete the object. 
The server must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word.

WM_DDE_UNADVISE = WM_DDE_FIRST + 3;
一个DDE客户程序通过此消息通知一个DDE服务程序不更新指定的项或一个特殊的剪贴板格式的项
A DDE client application posts a WM_DDE_UNADVISE message to inform a DDE server application that the specified item or a particular clipboard format for the item should no longer be updated. This terminates the warm or hot data link for the specified item. 
WM_DDE_UNADVISE 
wParam = (WPARAM) hwnd;        // handle of posting application 
lParam = (LPARAM) lParam;      // format and item atom  
Parameters
hwnd 
Value of wParam. Handle to the client window sending the message. 
lParam 
Holds the cfFormat and aItem parameters. Parameter Description 
cfFormat This is the LOWORD of lParam. Specifies the clipboard format of the item for which the update request is being retracted. If cfFormat is NULL, all active WM_DDE_ADVISE conversations for the item are to be terminated. 
aItem This is the HIWORD of lParam. Contains a global atom that identifies the item for which the update request is being retracted. When aItem is NULL, all active WM_DDE_ADVISE links associated with the conversation are to be terminated. 
Remarks
Posting 
The client application posts the WM_DDE_UNADVISE message by calling thePostMessage function, not theSendMessage function. 
The client application allocates aItem by calling the GlobalAddAtom function. 
Receiving 
The server application posts the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the server can either reuse the aItem atom, or it can delete the atom and create a new one.

WM_DDE_ACK = WM_DDE_FIRST + 4;
消息通知一个DDE(动态数据交换)程序已收到并正在处理WM_DDE_POKE, WM_DDE_EXECUTE, WM_DDE_DATA, WM_DDE_ADVISE, WM_DDE_UNADVISE, or WM_DDE_INITIAT消息
The WM_DDE_ACK message notifies a DDE application of the receipt and processing of a WM_DDE_POKE, WM_DDE_EXECUTE, WM_DDE_DATA, WM_DDE_ADVISE, WM_DDE_UNADVISE, or WM_DDE_INITIATE message, and in some cases, of a WM_DDE_REQUEST message. 
WM_DDE_ACK 
// Response to WM_DDE_INITIATE 
wParam = (WPARAM) hwnd;          // handle of posting application 
lParam = MAKELPARAM(aApp, aTopic) // application and topic atoms 
// Response to WM_DDE_EXECUTE 
wParam = (WPARAM) hwnd;         // handle of posting application 
lParam = (LPARAM) lPackedVal;   // packed status flags and data handle 
// Response to all other messages 
wParam = (WPARAM) hwnd;         // handle of posting application 
lParam = (LPARAM) lPackedVal;   // packed status flags and item 
 Parameters
When responding to WM_DDE_INITIATE: 
hwnd 
Value of wParam. Handle to the server window posting the message. 
aApp 
Value of the low-order word of lParam. Contains an atom that identifies the replying application. 
aTopic 
Value of the high-order word of lParam. Contains an atom that identifies the topic for which a conversation is being established. 
When responding to WM_DDE_EXECUTE: 
hwnd 
Value of wParam. Handle to the server window posting the message. 
lPackedVal 
Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is wStatus. The high-order word is the same hCommands that was received in the WM_DDE_EXECUTE message. Parameter Description 
wStatus Specifies a DDEACK structure containing a series of flags that indicate the status of the response.  
hCommands Handle to a global memory object that contains the command string. 
When replying to all other messages: 
hwnd 
Value of wParam. Handle to the client or server window posting the message. 
lPackedVal 
Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is wStatus. The high-order word is aItem. Parameter Description 
wStatus Specifies a DDEACK structure containing a series of flags that indicate the status of the response.  
aItem Contains a global atom that identifies the name of the data item for which the response is sent. 
Remarks
Posting
Except in response to the WM_DDE_INITIATE message, the application posts the WM_DDE_ACK message by calling thePostMessage function, not by calling theSendMessage function. When responding to WM_DDE_INITIATE, the application sends the WM_DDE_ACK message by calling SendMessage. In this case, neither the application-name atom nor the topic-name atom should be NULL (even if the WM_DDE_INITIATE message specified NULL atoms). 
When acknowledging any message with an accompanying aItem atom, the application posting WM_DDE_ACK can either reuse the aItem atom that accompanied the original message, or it can delete it and create a new one. 
When acknowledging WM_DDE_EXECUTE, the application that posts WM_DDE_ACK should reuse the global memory object identified in the original WM_DDE_EXECUTE message. 
All posted WM_DDE_ACK messages must create or reuse the lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function. 
If an application has initiated the termination of a conversation by posting WM_DDE_TERMINATE and is awaiting confirmation, the waiting application should not acknowledge (positively or negatively) any subsequent messages sent by the other application. The waiting application should delete any atoms or shared memory objects received in these intervening messages. Memory objects should not be freed if the fRelease flag is set to FALSE in WM_DDE_POKE, and WM_DDE_DATA messages. 
Receiving 
The application that receives a WM_DDE_ACK message should delete all atoms accompanying the message. If the application receives a WM_DDE_ACK in response to a message with an accompanying hData object, and the object was sent with the fRelease flags set to FALSE, the application is responsible for deleteing the hData object. 
If the application receives a negative WM_DDE_ACK message posted in reply to a WM_DDE_ADVISE message, the application should delete the global memory object posted with the original WM_DDE_ADVISE message (in hOptions). If the application receives a negative WM_DDE_ACK message posted in reply to a WM_DDE_DATA, WM_DDE_POKE, or WM_DDE_EXECUTE message, the application should delete the global memory object posted with the original WM_DDE_DATA, WM_DDE_POKE, or WM_DDE_EXECUTE message (in hCommands). 
The application that receives a posted WM_DDE_ACK message must free the lPackedVal parameter by using the FreeDDElParam function.

WM_DDE_DATA = WM_DDE_FIRST + 5;
一个DDE服务程序提交此消息给DDE客户程序来传递个一数据项给客户或通知客户的一条可用数据项
A DDE server application posts a WM_DDE_DATA message to a DDE client application to pass a data item to the client or to notify the client of the availability of a data item. 
WM_DDE_DATA 
wParam = (WPARAM) hwnd;         // handle of posting application 
lParam = (LPARAM) lPackedVal;   // packed DDEDATA and item atom 
Parameters
hwnd 
Value of wParam. Handle to the server window posting the message. 
lPackedVal 
Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hData or NULL. The high-order word is aItem. Parameter Description 
hData Handle to a global memory object containing a DDEDATA structure with the data and additional information. The handle should be set to NULL if the server is notifying the client that the data-item value has changed during a warm data link. A warm link is established by the client sending a WM_DDE_ADVISE message with the fDeferUpd bit set. 
aItem Contains an atom that identifies the data item for which the data or notification is sent. 
Remarks
Posting 
The server application posts the WM_DDE_DATA message by calling thePostMessage function, not theSendMessage function. 
The server application allocates hData by calling the GlobalAlloc function with the GMEM_DDESHARE option. It allocates aItem by calling the GlobalAddAtom function. 
The server must create or reuse the WM_DDE_DATA lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hData supplied as the low-order word and aItem supplied as the high-order word. 
If the receiving (client) application responds with a negative WM_DDE_ACK message, the posting (server) application must delete the hData object; otherwise, the client must delete the hData object after extracting its contents by calling the UnpackDDElParam function. 
If the server application sets the fRelease member of the DDEDATA structure to FALSE, the server is responsible for deleting hData upon receiving either a positive or negative acknowledgement. 
The server application should not set both the fAckReq and fRelease members of the DDEDATA structure to FALSE. If both members are set to FALSE, it is impossible for the server to determine when to delete hData. 
Receiving 
If fAckReq is TRUE, the client application should post the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the client can either reuse the aItem atom, or it can delete it and create a new one. 
The client must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word. 
If fAckReq is FALSE, the client application should delete the aItem atom. 
If the posting (server) application specified hData as NULL, the receiving (client) application can request the server to send the data by posting a WM_DDE_REQUEST message. 
After processing a WM_DDE_DATA message in which hData is not NULL, the client should free hData, unless one of the following conditions is true: 
The fRelease member is FALSE. 
The fRelease member is TRUE, but the client application responds with a negative WM_DDE_ACK message.

WM_DDE_REQUEST = WM_DDE_FIRST + 6;
一个DDE客户程序提交此消息给一个DDE服务程序来请求一个数据项的值;
A DDE client application posts a WM_DDE_REQUEST message to a DDE server application to request the value of a data item. 
WM_DDE_REQUEST 
wParam = (WPARAM) hwnd;        // handle of posting application 
lParam = (LPARAM) lParam;      // holds cfFormat and aItem  
Parameters
hwnd 
Value of wParam. Handle to the client window sending the message. 
lParam 
Holds the cfFormat and aItem parameters. Parameter Description 
cfFormat This is the LOWORD of lParam. Specifies a standard or registered clipboard format. 
aItem This is the HIWORD of lParam. Contains an atom that identifies the data item requested from the server. 
Remarks
Posting 
The client application posts the WM_DDE_REQUEST message by calling thePostMessage function, not theSendMessage function. 
The client application allocates aItem by calling the GlobalAddAtom function. 
Receiving 
If the receiving (server) application can satisfy the request, it responds with a WM_DDE_DATA message containing the requested data. Otherwise, it responds with a negative WM_DDE_ACK message. 
When responding with either a WM_DDE_DATA or WM_DDE_ACK message, the server application can either reuse the aItem atom or it can delete the atom and create a new one.

WM_DDE_POKE = WM_DDE_FIRST + 7;
一个DDE客户程序提交此消息给一个DDE服务程序,客户使用此消息来请求服务器接收一个未经同意的数据项;服务器通过答复WM_DDE_ACK消息提示是否它接收这个数据项;
A DDE client application posts a WM_DDE_POKE message to a DDE server application. A client uses this message to request the server to accept an unsolicited data item. The server is expected to reply with a WM_DDE_ACK message indicating whether it accepted the data item. 
WM_DDE_POKE 
wParam = (WPARAM) hwnd;        // handle of posting application 
lParam = (LPARAM) lPackedVal;  // packed DDEPOKE and item atom  
Parameters
hwnd 
Value of wParam. Handle to the client window posting the message. 
lPackedVal 
Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hData. The high-order word is aItem. Parameter Description 
hData Handle to a global memory object containing a DDEPOKE structure with the data and additional information.  
aItem Contains a global atom that identifies the data item for which the data or notification is being sent. 
Remarks
Posting 
The client application posts the WM_DDE_POKE message by using thePostMessage function. 
The client application must allocate memory for the hData object by using the GlobalAlloc function with the GMEM_DDESHARE option. The client application must delete the hData object if either of the following conditions is true: 
The server application responds with a negative WM_DDE_ACK message. 
The fRelease member is FALSE, but the server application responds with either a positive or negative WM_DDE_ACK. 
The client application must create the aItem atom by using the GlobalAddAtom function. 
The client application must create or reuse the WM_DDE_POKE lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hData supplied as the low-order word and aItem supplied as the high-order word. 
Receiving 
The server application should post the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the server can either reuse the aItem atom, or it can delete it and create a new one. 
The server must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word. 
To free the hData object, the server should call the GlobalFree function. Also, if the data format is either CF_DSPMETAFILEPICT or CF_METAFILEPICT, the server must also call DeleteMetaFile with the embedded metafile handle. These two formats have an extra level of indirection; that is, an application must lock hData to get a pointer to a handle, then lock that handle to get a pointer to a METAFILEPICT structure, and finally call DeleteMetaFile with the handle from the hMF member of the METAFILEPICT structure. 
To free the lPackedVal object, the server should call the FreeDDElParam function.

WM_DDE_EXECUTE = WM_DDE_FIRST + 8;
一个DDE客户程序提交此消息给一个DDE服务程序来发送一个字符串给服务器让它象串行命令一样被处理,服务器通过提交WM_DDE_ACK消息来作回应;
A DDE client application posts a WM_DDE_EXECUTE message to a DDE server application to send a string to the server to be processed as a series of commands. The server application is expected to post a WM_DDE_ACK message in response. 
WM_DDE_EXECUTE 
wParam = (WPARAM) hwnd;        // handle of posting application 
lParam = (LPARAM) hCommands;   // handle to global object  
Parameters
hwnd 
Value of wParam. Handle to the client window posting the message. 
hCommands 
Value of lParam. Contains a global memory object that references an ANSI or Unicode command string, depending on the types of windows involved in the conversation. 
Remarks
The command string is a null-terminated string consisting of one or more opcode strings enclosed in single brackets ([ ]). 
Each opcode string has the following syntax, where the parameters list is optional: 
opcode parameters 
The opcode is any application-defined single token. It cannot include spaces, commas, parentheses, brackets, or quotation marks. 
The parameters list can contain any application-defined value or values. Multiple parameters are separated by commas, and the entire parameter list is enclosed in parentheses. Parameters cannot include commas or parentheses except inside a quoted string. If a bracket or parenthesis character is to appear in a quoted string, it need not be doubled, as was the case under the old rules. 
Following are some valid command strings: 
[connect][download(query1,results.txt)][disconnect] 
[query("sales per employee for each district")] 
[open("sample.xlm")][run("r1c1")] 
[quote_case("This is a "" character")] 
[bracket_or_paren_case("()s or []s should be no problem.")] 
 Note that, under the old rules, parentheses and brackets had to be doubled, as follows: 
[bracket_or_paren_case("(())s or [[]]s should be no problem.")] 
 Servers should be able to parse commands in either form. 
Unicode execute strings should be used only when both the client and server window handles cause theIsWindowUnicode function to return TRUE. 
Posting 
The client application posts the WM_DDE_EXECUTE message by calling thePostMessage function, not theSendMessage function. 
The client application allocates hCommands by calling the GlobalAlloc function with the GMEM_DDESHARE option. 
When processing the WM_DDE_ACK message that the server posts in reply to a WM_DDE_EXECUTE message, the client application must delete the hCommands object sent back in the WM_DDE_ACK message. 
Receiving 
The server application posts the WM_DDE_ACK message to respond positively or negatively. The server should reuse the hCommands object. 
Unless specified otherwise by a sub-protocol, the server should not post the WM_DDE_ACK message until all the actions specified by the execute command string are completed. The one exception to this rule is when the string causes the server to terminate the conversation.

WM_DDE_LAST = WM_DDE_FIRST + 8;

WM_APP = H8000;

WM_USER = H0400;
消息能帮助应用程序自定义私有消息

通知消息(Notification message)是指这样一种消息,一个窗口内的子控件发生了一些事情,需要通知父窗口。通知消息只适用于标准的窗口控件如按钮、列表框、组合框、编辑框,以及Windows 95公共控件如树状视图、列表视图等。例如,单击或双击一个控件、在控件中选择部分文本、操作控件的滚动条都会产生通知消息

一、Child Window Notification Window(标准的窗口控件WM_COMMAND通知消息)通知消息映射
1.Generic Control 消息消息映射
ON_CONTROL( <wNotifyCode>, <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn ) afx_msg void memberFxn(UINT nID)

2.按扭
BN_CLICKED //用户单击了按钮
BN_DISABLE //按钮被禁止
BN_DOUBLECLICKED //用户双击了按钮
BN_HILITE //用户加亮了按钮
BN_PAINT按钮应当重画
BN_UNHILITE加亮应当去掉

ON_BN_CLICKED( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_BN_DISABLE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_BN_DOUBLECLICKED( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_BN_HILITE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_BN_PAINT( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_BN_UNHILITE( <id>, <memberFxn> ) afx_msg void memberFxn( );

3.组合框
CBN_CLOSEUP组合框的列表框被关闭
CBN_DBLCLK用户双击了一个字符串
CBN_DROPDOWN组合框的列表框被拉出
The CBN_DROPDOWN notification message is sent when the list box of a combo box is about to be made visible. The parent window of the combo box receives this notification message through the WM_COMMAND message. 
CBN_DROPDOWN 
idComboBox = (int) LOWORD(wParam);  // identifier of combo box 
hwndComboBox = (HWND) lParam;       // handle to combo box  
Remarks
This notification message can occur only for a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style. 
CBN_EDITCHANGE用户修改了编辑框中的文本
CBN_EDITUPDATE编辑框内的文本即将更新
CBN_ERRSPACE组合框内存不足
CBN_KILLFOCUS组合框失去输入焦点
CBN_SELCHANGE在组合框中选择了一项
CBN_SELENDCANCEL用户的选择应当被取消
CBN_SELENDOK用户的选择是合法的
CBN_SETFOCUS组合框获得输入焦点

ON_CBN_CLOSEUP( <id>, <memberFxn> ) afx_msg void memberFxn( ) 
ON_CBN_DBLCLK( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_DROPDOWN( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_EDITCHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_EDITUPDATE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_ERRSPACE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_KILLFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_SELCHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_SELENDCANCEL( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_SELENDOK( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CBN_SETFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( );

4.编辑框
EN_CHANGE编辑框中的文本己更新
EN_ERRSPACE编辑框内存不足
EN_HSCROLL用户点击了水平滚动条
EN_KILLFOCUS编辑框正在失去输入焦点
EN_MAXTEXT插入的内容被截断
EN_SETFOCUS编辑框获得输入焦点
EN_UPDATE编辑框中的文本将要更新
EN_VSCROLL用户点击了垂直滚动条消息含义

ON_EN_CHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_EN_ERRSPACE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_EN_HSCROLL( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_EN_KILLFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_EN_MAXTEXT( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_EN_SETFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_EN_UPDATE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_EN_VSCROLL( <id>, <memberFxn> ) afx_msg void memberFxn( );

5.列表框
LBN_DBLCLK用户双击了一项
LBN_ERRSPACE列表框内存不够
LBN_KILLFOCUS列表框正在失去输入焦点
LBN_SELCANCEL选择被取消
LBN_SELCHANGE选择了另一项
LBN_SETFOCUS列表框获得输入焦点

ON_LBN_DBLCLK( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_LBN_ERRSPACE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_LBN_KILLFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_LBN_SELCHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_LBN_SETFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( );

二、Window消息消息映射
ON_WM_ACTIVATE( ) afx_msg void OnActivate( UINT, CWnd*, BOOL ); 
ON_WM_ACTIVATEAPP( ) afx_msg void OnActivateApp( BOOL, HANDLE ); 
ON_WM_ASKCBFORMATNAME( ) afx_msg void OnAskCbFormatName( UINT, LPSTR ); 
ON_WM_CANCELMODE( ) afx_msg void OnCancelMode( ); 
ON_WM_CAPTURECHANGED( ) afx_msg void OnCaptureChanged( CWnd* ); 
ON_WM_CHANGECBCHAIN( ) afx_msg void OnChangeCbChain( HWND, HWND ); 
ON_WM_CHAR( ) afx_msg void OnChar( UINT, UINT, UINT ); 
ON_WM_CHARTOITEM( ) afx_msg int OnCharToItem( UINT, CWnd*, UINT ); 
ON_WM_CHILDACTIVATE( ) afx_msg void OnChildActivate( ); 
ON_WM_CLOSE( ) afx_msg void OnClose( ); 
ON_WM_COMPACTING( ) afx_msg void OnCompacting( UINT ); 
ON_WM_COMPAREITEM( ) afx_msg int OnCompareItem( LPCOMPAREITEMSTRUCT ); 
ON_WM_CONTEXTMENU( ) afx_msg void OnContextMenu( CWnd*, CPoint ); 
ON_WM_COPYDATA( ) afx_msg BOOL OnCopyData( CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct ); 操作系统维护一块内存来管理 WM_COPYDATA 消息,该消息主要用于跨进程传递数据
ON_WM_CREATE( ) afx_msg int OnCreate( LPCREATESTRUCT ); 
ON_WM_CTLCOLOR( ) afx_msg HBRUSH OnCtlColor( CDC*, CWnd*, UINT ); 
ON_WM_DEADCHAR( ) afx_msg void OnDeadChar( UINT, UINT, UINT ); 
ON_WM_DELETEITEM( ) afx_msg void OnDeleteItem( LPDELETEITEMSTRUCT ); 
ON_WM_DESTROY( ) afx_msg void OnDestroy( ); 
ON_WM_DESTROYCLIPBOARD( ) afx_msg void OnDestroyClipboard( ); 
ON_WM_DEVICECHANGE( ) afx_msg void OnDeviceChange( UINT, DWORD ); 
ON_WM_DEVMODECHANGE( ) afx_msg void OnDevModeChange( LPSTR ); 
ON_WM_DRAWCLIPBOARD( ) afx_msg void OnDrawClipboard( ); 
ON_WM_DRAWITEM( ) afx_msg void OnDrawItem( LPDRAWITEMSTRUCT ); 
ON_WM_DROPFILES( ) afx_msg void OnDropFiles( HDROP ); 
ON_WM_ENABLE( ) afx_msg void OnEnable( BOOL ); 
ON_WM_ENDSESSION( ) afx_msg void OnEndSession( BOOL ); 
ON_WM_ENTERIDLE( ) afx_msg void OnEnterIdle( UINT, CWnd* ); 
ON_WM_ERASEBKGND( ) afx_msg BOOL OnEraseBkgnd( CDC * ); 
ON_WM_FONTCHANGE( ) afx_msg void OnFontChange( ); 
ON_WM_GETDLGCODE( ) afx_msg UINT OnGetDlgCode( ); 
ON_WM_GETMINMAXINFO( ) afx_msg void OnGetMinMaxInfo( LPPOINT ); 
ON_WM_HELPINFO( ) afx_msg BOOL OnHelpInfo( HELPINFO* ); 
ON_WM_HSCROLL( ) afx_msg void OnHScroll( UINT, UINT, CWnd* ); 
ON_WM_HSCROLLCLIPBOARD( ) afx_msg void OnHScrollClipboard CWnd*, UINT, UINT ); 
ON_WM_ICONERASEBKGND( ) afx_msg void OnIconEraseBkgnd( CDC * ); 
ON_WM_INITMENU( ) afx_msg void OnInitMenu( CMenu * ); 
ON_WM_INITMENUPOPUP( ) afx_msg void OnInitMenuPopup( CMenu *, UINT, BOOL ); 
ON_WM_KEYDOWN( ) afx_msg void OnKeyDown( UINT, UINT, UINT ); 
ON_WM_KEYUP( ) afx_msg void OnKeyUp( UINT, UINT, UINT ); 
ON_WM_KILLFOCUS( ) afx_msg void OnKillFocus( CWnd* ); 
ON_WM_LBUTTONDBLCLK( ) afx_msg void OnLButtonDblClk( UINT, CPoint ); 
ON_WM_LBUTTONDOWN( ) afx_msg void OnLButtonDown( UINT, CPoint ); 
ON_WM_LBUTTONUP( ) afx_msg void OnLButtonUp( UINT, CPoint ); 
ON_WM_MBUTTONDBLCLK( ) afx_msg void OnMButtonDblClk( UINT, CPoint ); 
ON_WM_MBUTTONDOWN( ) afx_msg void OnMButtonDown( UINT, CPoint ); 
ON_WM_MBUTTONUP( ) afx_msg void OnMButtonUp( UINT, CPoint ); 
ON_WM_MDIACTIVATE( ) afx_msg void OnMDIActivate( BOOL, CWnd*, CWnd* ); 
ON_WM_MEASUREITEM( ) afx_msg void OnMeasureItem( LPMEASUREITEMSTRUCT ); 
ON_WM_MENUCHAR( ) afx_msg LONG OnMenuChar( UINT, UINT, CMenu * ); 
ON_WM_MENUSELECT( ) afx_msg void OnMenuSelect( UINT, UINT, HMENU ); 
ON_WM_MOUSEACTIVATE( ) afx_msg int OnMouseActivate( CWnd*, UINT, UINT ); 
ON_WM_MOUSEMOVE( ) afx_msg void OnMouseMove( UINT, CPoint ); 
ON_WM_MOUSEWHEEL( ) afx_msg BOOL OnMouseWheel( UINT, short, CPoint ); 
ON_WM_MOVE( ) afx_msg void OnMove( int, int ); 
ON_WM_MOVING( ) afx_msg void OnMoving( UINT, LPRECT ); 
ON_WM_NCACTIVATE( ) afx_msg BOOL OnNcActivate( BOOL ); 
ON_WM_NCCALCSIZE( ) afx_msg void OnNcCalcSize( BOOL, NCCALCSIZE_PARAMS FAR* ); 
ON_WM_NCCREATE( ) afx_msg BOOL OnNcCreate( LPCREATESTRUCT ); 
ON_WM_NCDESTROY( ) afx_msg void OnNcDestroy( ); 
ON_WM_NCHITTEST( ) afx_msg UINT OnNcHitTest( CPoint ); 
ON_WM_NCLBUTTONDBLCLK( ) afx_msg void OnNcLButtonDblClk( UINT, CPoint ); 
ON_WM_NCLBUTTONDOWN( ) afx_msg void OnNcLButtonDown( UINT, CPoint ); 
ON_WM_NCLBUTTONUP( ) afx_msg void OnNcLButtonUp( UINT, CPoint ); 
ON_WM_NCMBUTTONDBLCLK( ) afx_msg void OnNcMButtonDblClk( UINT, CPoint ); 
ON_WM_NCMBUTTONDOWN( ) afx_msg void OnNcMButtonDown( UINT, CPoint ); 
ON_WM_NCMBUTTONUP( ) afx_msg void OnNcMButtonUp( UINT, CPoint ); 
ON_WM_NCMOUSEMOVE( ) afx_msg void OnNcMouseMove( UINT, CPoint ); 
ON_WM_NCPAINT( ) afx_msg void OnNcPaint( ); 
ON_WM_NCRBUTTONDBLCLK( ) afx_msg void OnNcRButtonDblClk( UINT, CPoint ); 
ON_WM_NCRBUTTONDOWN( ) afx_msg void OnNcRButtonDown( UINT, CPoint ); 
ON_WM_NCRBUTTONUP( ) afx_msg void OnNcRButtonUp( UINT, CPoint ); 
ON_WM_PAINT( ) afx_msg void OnPaint( ); 
ON_WM_PAINTCLIPBOARD( ) afx_msg void OnPaintClipboard( CWnd*, HANDLE ); 
ON_WM_PALETTECHANGED( ) afx_msg void OnPaletteChanged( CWnd* ); 
ON_WM_PALETTEISCHANGING( ) afx_msg void OnPaletteIsChanging( CWnd* ); 
ON_WM_PARENTNOTIFY( ) afx_msg void OnParentNotify( UINT, LONG ); 
ON_WM_QUERYDRAGICON( ) afx_msg HCURSOR OnQueryDragIcon( ); 
ON_WM_QUERYENDSESSION( ) afx_msg BOOL OnQueryEndSession( ); 
ON_WM_QUERYNEWPALETTE( ) afx_msg BOOL OnQueryNewPalette( ); 
ON_WM_QUERYOPEN( ) afx_msg BOOL OnQueryOpen( ); 
ON_WM_RBUTTONDBLCLK( ) afx_msg void OnRButtonDblClk( UINT, CPoint ); 
ON_WM_RBUTTONDOWN( ) afx_msg void OnRButtonDown( UINT, CPoint ); 
ON_WM_RBUTTONUP( ) afx_msg void OnRButtonUp( UINT, CPoint ); 
ON_WM_RENDERALLFORMATS( ) afx_msg void OnRenderAllFormats( ); 
ON_WM_RENDERFORMAT( ) afx_msg void OnRenderFormat( UINT ); 
ON_WM_SETCURSOR( ) afx_msg BOOL OnSetCursor( CWnd*, UINT, UINT ); 
ON_WM_SETFOCUS( ) afx_msg void OnSetFocus( CWnd* ); 
ON_WM_SHOWWINDOW( ) afx_msg void OnShowWindow( BOOL, UINT ); 
ON_WM_SIZE( ) afx_msg void OnSize( UINT, int, int ); 
ON_WM_SIZECLIPBOARD( ) afx_msg void OnSizeClipboard( CWnd*, HANDLE ); 
ON_WM_SIZING( ) afx_msg void OnSizing( UINT, LPRECT );  
ON_WM_SPOOLERSTATUS( ) afx_msg void OnSpoolerStatus( UINT, UINT ); 
ON_WM_STYLECHANGED( ) afx_msg void OnStyleChanged( int, LPSTYLESTRUCT ); 
ON_WM_STYLECHANGING( ) afx_msg void OnStyleChanging( int, LPSTYLESTRUCT ); 
ON_WM_SYSCHAR( ) afx_msg void OnSysChar( UINT, UINT, UINT ); 
ON_WM_SYSCOLORCHANGE( ) afx_msg void OnSysColorChange( ); 
ON_WM_SYSCOMMAND( ) afx_msg void OnSysCommand( UINT, LONG ); 
ON_WM_SYSDEADCHAR( ) afx_msg void OnSysDeadChar( UINT, UINT, UINT ); 
ON_WM_SYSKEYDOWN( ) afx_msg void OnSysKeyDown( UINT, UINT, UINT ); 
ON_WM_SYSKEYUP( ) afx_msg void OnSysKeyUp( UINT, UINT, UINT ); 
ON_WM_TCARD( ) afx_msg void OnTCard( UINT, DWORD ); 
ON_WM_TIMECHANGE( ) afx_msg void OnTimeChange( ); 
ON_WM_TIMER( ) afx_msg void OnTimer( UINT ); 
ON_WM_VKEYTOITEM( ) afx_msg int OnVKeyToItem( UINT, CWnd*, UINT ); 
ON_WM_VSCROLL( ) afx_msg void OnVScroll( UINT, UINT, CWnd* ); 
ON_WM_VSCROLLCLIPBOARD( ) afx_msg void OnVScrollClipboard( CWnd*, UINT, UINT ); 
ON_WM_WINDOWPOSCHANGED( ) afx_msg void OnWindowPosChanged( WINDOWPOS* lpwndpos ); 
ON_WM_WINDOWPOSCHANGING( ) afx_msg void OnWindowPosChanging( WINDOWPOS* lpwndpos ); 
ON_WM_WININICHANGE( ) afx_msg void OnWinIniChange( LPSTR );

三、命令消息映射
ON_COMMAND(<id>, <memberFxn>) afx_msg void memberFxn( ); 
ON_COMMAND_EX(<id>, <memberFxn>) afx_msg BOOL memberFxn(UINT nID);
ON_COMMAND_RANGE(nID,nLastID,pfn) afx_msg void memberFxn(UINT nID)
ON_UPDATE_COMMAND_UI(<id>, <memberFxn>) afx_msg void memberFxn(CCmdUI* pCmdUI);
ON_UPDATE_COMMAND_UI_RANGE(nID,nLastID,pfn) afx_msg void memberFxn(CCmdUI* pCmdUI)

四、WM_COMMAND通知消息映射(只适用于标准的窗口控件):
ON_CONTROL( <wNotifyCode>, <id>, <memberFxn> ) afx_msg void memberFxn( ); 
ON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn ) afx_msg void memberFxn(UINT nID)

五、消息映射(只适用于Windows公共控件):
ON_NOTIFY( wNotifyCode, id, memberFxn ) afx_msg void memberFxn( NMHDR * pNotifyStruct, LRESULT * result );
ON_NOTIFY_RANGE( wNotifyCode, id, idLast, memberFxn ) afx_msg void memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT * result );
ON_NOTIFY_EX( nCode, id, memberFxn ) afx_msg BOOL memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT * result );
ON_NOTIFY_EX_RANGE( wNotifyCode, id, idLast, memberFxn ) afx_msg BOOL memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT * result );

六、反射消息映射(父窗口处理通知消息WM_CTLCOLOR、WM_COMMAND、WM_NOTIFY时,反射回子控件窗口处理):
ON_CONTROL_REFLECT( wNotifyCode, memberFxn ) afx_msg void memberFxn(); 
ON_NOTIFY_REFLECT( wNotifyCode, memberFxn ) afx_msg void memberFxn ( NMHDR * pNotifyStruct, LRESULT* result ); 
ON_UPDATE_COMMAND_UI_REFLECT( memberFxn ) afx_msg void memberFxn ( CCmdUI* pCmdUI ); 
ON_WM_CTLCOLOR_REFLECT( ) afx_msg HBRUSH CtlColor ( CDC* pDC, UINT nCtlColor ); 
ON_WM_DRAWITEM_REFLECT( ) afx_msg void DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ); 
ON_WM_MEASUREITEM_REFLECT( ) afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct ); 
ON_WM_DELETEITEM_REFLECT( ) afx_msg void DeleteItem ( LPDELETEITEMSTRUCT lpDeleteItemStruct ); 
ON_WM_COMPAREITEM_REFLECT( ) afx_msg int CompareItem ( LPCOMPAREITEMSTRUCT lpCompareItemStruct ); 
ON_WM_CHARTOITEM_REFLECT( ) afx_msg int CharToItem ( UINT nKey, UINT nIndex ); 
ON_WM_VKEYTOITEM_REFLECT( ) afx_msg int VKeyToItem ( UINT nKey, UINT nIndex ); 
ON_WM_HSCROLL_REFLECT( ) afx_msg void HScroll ( UINT nSBCode, UINT nPos ); 
ON_WM_VSCROLL_REFLECT( ) afx_msg void VScroll ( UINT nSBCode, UINT nPos ); 
ON_WM_PARENTNOTIFY_REFLECT( ) afx_msg void ParentNotify ( UINT message, LPARAM lParam );

ON_NOTIFY_REFLECT_EX( wNotifyCode, memberFxn ) afx_msg BOOL memberFxn ( NMHDR * pNotifyStruct, LRESULT* result ); 
ON_CONTROL_REFLECT_EX( wNotifyCode, memberFxn ) afx_msg BOOL memberFxn();

七、自定义的窗口消息映射(至少是WM_USER+100,因为许多控件都使用这一范围的WM_USER消息):
ON_MESSAGE( <message>, <memberFxn> ) afx_msg LRESULT memberFxn( WPARAM, LPARAM );

八、注册消息映射(用RegisterWindowMessage函数注册的消息):
ON_REGISTERED_MESSAGE( <nMessageVariable>, <memberFxn> ) afx_msg LRESULT memberFxn( WPARAM, LPARAM );

九、线程消息映射(只有继承自CWinThread类才能允许处理线程消息。自定义WM_USER或注册RegisterWindowMessage的消息标记。由PostThreadMessage引发):
ON_THREAD_MESSAGE( <message>, <memberFxn> ) afx_msg void memberFxn( WPARAM, LPARAM ); 
ON_REGISTERED_THREAD_MESSAGE( <nMessageVariable>, <memberFxn> ) afx_msg void memberFxn( WPARAM, LPARAM );

时间: 2024-10-13 02:22:48

windows消息机制详解(转载)的相关文章

Windows消息机制详解

消息是指什么?      消息系统对于一个win32程序来说十分重要,它是一个程序运行的动力源泉.一个消息,是系统定义的一个32位的值,他唯一的定义了一个事件,向 Windows发出一个通知,告诉应用程序某个事情发生了.例如,单击鼠标.改变窗口尺寸.按下键盘上的一个键都会使Windows发送一个消息给应用程序. 消息本身是作为一个记录传递给应用程序的,这个记录中包含了消息的类型以及其他信息.例如,对于单击鼠标所产生的消息来说,这个记录中包含了单击鼠标时的坐标.这个记录类型叫做MSG,MSG含有来

Windows 消息机制详解

总的来说: MSG包括: 窗口句柄,指示MSG发送的目的窗口 消息标识 lPARAM.wParam 发送时间 发送时的鼠标位置   关于消息队列: Windows系统有一个系统消息队列 每个线程都有一个自己的消 息队列(由于发送消息MSG需 要提供一个窗口HWnd,而基 本有窗口的线程,都是UI线 程),因此基本上如果线程使用了GDI函数,则windows给该线程分配一个线程消息队列,这个消息队列负责该线程的所有窗口的消息.   所有的窗口都有自己的句柄(HWND),消息被发送时,这个句柄就已经

Windows消息传递机制详解

Windows是一个消息(Message)驱动系统.Windows的消息提供了应用程序之间.应用程序与Windows系统之间进行通信的手段.应用程序想要实现的功能由消息来触发,并且靠对消息的响应和处理来完成.必须注意的是,消息并非是抢占性的,无论事件的缓急,总是按照到达的先后派对,依次处理(一些系统消息除外),这样可能使一些实时外部事件得不到及时处理. Windows的应用程序一般包含窗口(Window),它主要为用户提供一种可视化的交互方式,窗口是总是在某个线程(Thread)内创建的.Win

Handler详解系列(一)——Handler异步消息机制详解(附图)

MainActivity如下: package cc.cn; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Log; import android.app.Activity; /** * Demo描述: * Android异步消息机制分析(附图) * * ===================

[转]Handler消息机制详解

能简单说得我们尽量不复杂: 为了避免ANR,我们会通常把 耗时操作放在子线程里面去执行,因为子线程不能更新UI,所以当子线程需要更新的UI的时候就需要借助到安卓的消息机制,也就是Handler机制了. 注意:在安卓的世界里面,当 子线程 在执行耗时操作的时候,不是说你的主线程就阻塞在那里等待子线程的完成--也不是调用 Thread.wait()或是Thread.sleep().安卓采取的方法是,主线程应该为子线程提供一个Handler,以便完成时能够提交给主线程.以这种方式设计你的应用程序,将能

Android Handler和他的小伙伴们,消息机制详解

Handler一直是面试很热的话题,最近又看了好多文章,下面结合源码来总结一下. Handler 是Android 消息机制的上层接口,Handler的运行需要底层的MessageQueue和Looper的支撑,他们是Handler的好基友.Handler的运行机制也就是Android的消息机制. 我们都知道Handler是用来更新UI的,其实更新UI只是开发者最常用的场景.概括来讲:有时候需要在子线中进行耗时较长的I/O操纵,而I/O操作完成后需要在UI上做一些改变,这个时候可以通过Handl

JavaScript 运行机制详解

JavaScript 运行机制详解——转载: 一.为什么JavaScript是单线程? JavaScript语言的一大特点就是单线程,也就是说,同一个时间只能做一件事.那么,为什么JavaScript不能有多个线程呢?这样能提高效率啊. JavaScript的单线程,与它的用途有关.作为浏览器脚本语言,JavaScript的主要用途是与用户互动,以及操作DOM.这决定了它只能是单线程,否则会带来很复杂的同步问题.比如,假定JavaScript同时有两个线程,一个线程在某个DOM节点上添加内容,另

(转载)Windows消息机制

文章出处:http://www.cnblogs.com/watsonyin/archive/2005/12/12/295536.html Windows消息机制 Windows操作系统最大的特点就是其图形化的操作界面,其图形化界面是建立在其消息处理机制这个基础之上的.如果不理解Windows消息处理机制,肯定无法深入的理解Windows编程.可惜很多程序员对Windows消息只是略有所闻,对其使用知之甚少,更不了解其内部实现原理,本文试着一步一步向大家披露我理解的Windows消息机制.可以说,

FileUpload上传控件用法详解 (转载)

FileUpload 类显示一个文本框控件和一个浏览按钮,使用户可以选择客户端上的文件并将它上载到 Web 服务器.用户通过在控件的文本框中输入本地计算机上文件的完整路径(例如,C:\MyFiles\TestFile.txt )来指定要上载的文件.用户也可以通过单击“浏览” 按钮,然后在“选择文件” 对话框中定位文件来选择文件. 注意: FileUpload 控件设计为仅用于部分页面呈现期间的回发情况,并不用于异步回发情况.在 UpdatePanel 控件内部使用 FileUpload 控件时,