关于WM_Notify和WM_Command

 

The original Windows controls sent their notifications in WM_COMMAND messages.

『原生的window控件是以WM_Command消息来发送通知』

The standard 32-bit wParam and lParam message parameters are not sufficient,

『标准的32位的wParam和lParam消息参数并不足够』

however, for the information that a common control needs to send to its parent.

『然而,common control需要发送那些大量的信息给它的父控件。』

Microsoft solved this "bandwidth" problem by defining a new message, WM_NOTIFY.

『微软采用定义一个新的消息WM_Notify来解决这种“带宽”问题。』

With the WM_NOTIFY message, wParam is the control ID and lParam is a pointer to an NMHDR structure, which is managed by the control.

『对于WM_NOTIFY消息,wParam是Control ID,而LPARAM是一个指向由控件管理的NMHDR structure的指针,』

 This C structure is defined by the following code:

 以下是C结构表示的NMHDR structure

typedef struct tagNMHDR {

    HWND hwndFrom; // handle to control sending the message

    UINT idFrom;   // ID of control sending the message

    UINT code;     // control-specific notification code

} NMHDR;

 

Many controls, however, send WM_NOTIFY messages with pointers to structures larger than NMHDR. Those structures contain the three members above plus appended control-specific members. Many tree control notifications, for example, pass a pointer to an NM_TREEVIEW structure that contains TV_ITEM structures, a drag point, and so forth. When ClassWizard maps a WM_NOTIFY message, it generates a pointer to the appropriate structure.

你可能感兴趣的:(command,Microsoft,Parameters,notifications,structure,Pointers)