091101(星期天)OnNotify函数的msdn描述

来源:互联网 发布:linux添加路由脚本命令 编辑:程序博客网 时间:2024/05/16 18:59

 

1101 OnNotify函数的msdn描述

OnNotify

The framework calls this member function to inform the parent window通知其父窗口控件发生了一个事件 或者 控件需要某种信息 of a control that an event has occurred in the control or that the control requires some kind of information.

 

virtual BOOL OnNotify(

   WPARAM wParam,

   LPARAM lParam,

   LRESULT* pResult

);

Parameters

wParam

Identifies the control that sends the message if the message is from a control. Otherwise, wParam is 0. 这个对控件的标示是句柄还是指针?参考下面的idFrom,最可能是控件ID

lParam

Pointer to a notification message (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. 甚至可以是NMHDR为第一个子成员的更大结构

 

typedef struct tagNMHDR {

    HWND hwndFrom; // Window handle to the control sending a message

    UINT idFrom; // Identifier of the control sending a message.

    UINT code; // Notification code. This member can be a control-specific notification code or it can be one of the common notification codes

} NMHDR;

 

 

pResult 这个是出参

Pointer to an LRESULT variable in which to store the result code if the message is handled.

Return Value

An application returns nonzero 处理消息即为非零if it processes this message; otherwise 0.

 

Remarks

OnNotify processes the message map for control notification.

 

Override this member function in your derived class to handle the WM_NOTIFY message. An override will not process the message map unless the base class OnNotify is called. 可以试试重写这个虚函数,着重观察双击的时候“展开/合拢”的情况。

 

For more information on the WM_NOTIFY message, see Technical Note 61 (TN061), ON_NOTIFY and WM_NOTIFY messages. You may also be interested the related topics described in Control Topics, and TN062, Message Reflection for Windows Controls.

 

原创粉丝点击