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

本文详细介绍了OnNotify函数的作用及参数,解释了如何处理WM_NOTIFY消息并提供了重写该函数的方法。OnNotify函数用于通知父窗口控件发生的事件或所需信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值