关于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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值