NOTIFY_HANDLER
Defines an entry in a message map.
NOTIFY_HANDLER(
id,
cd,
func
)
Parameters
id
[in] The identifier of the control sending the message.cd
[in] The notification code.func
[in] The name of the message-handler function.
Remarks
NOTIFY_HANDLER maps a WM_NOTIFY message to the specified handler function, based on the notification code and the control identifier.
Any function specified in a NOTIFY_HANDLER macro must be defined as follows:
LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
The message map sets bHandled to TRUE before NotifyHandler is called. If NotifyHandler does not fully handle the message, it should set bHandled to FALSE to indicate the message needs further processing.
Note
Always begin a message map with BEGIN_MSG_MAP. You can then declare subsequent alternate message maps with ALT_MSG_MAP. The END_MSG_MAP macro marks the end of the message map. Every message map must have exactly one instance of BEGIN_MSG_MAP and END_MSG_MAP.
In addition to NOTIFY_HANDLER, you can use MESSAGE_HANDLER to map a WM_NOTIFY message without regard to an identifier or code. In this case, MESSAGE_HANDLER(WM_NOTIFY, OnHandlerFunction) will direct all WM_NOTIFY messages to OnHandlerFunction.
For more information about using message maps in ATL, see Message Maps.
Example
class CMyDialog2 : public CDialogImpl<CMyDialog2>
{
public:
enum { IDD = IDD_MYDLG };
BEGIN_MSG_MAP(CMyDialog2)
NOTIFY_HANDLER(IDC_TREE1, NM_CLICK, OnNMClickTree1)
END_MSG_MAP()
public:
// When a CMyDialog2 object receives a WM_NOTIFY message
// identified by IDC_TREE1 and NM_CLICK, the message is
// directed to CMyDialog2::OnNMClickTree1 for the actual
// processing.
LRESULT OnNMClickTree1(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
};
Requirements
Header: atlwin.h