NOTIFY_HANDLER
TOC
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

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 CMyClass : ...
{
public:
   ...

   BEGIN_MSG_MAP(CMyClass)
      NOTIFY_HANDLER(IDC_MYCTL, NM_CLICK, OnClick)
      ...
   END_MSG_MAP()

   // When a CMyClass object receives a WM_NOTIFY
   // message identified by IDC_MYCTL and NM_CLICK,
   // the message is directed to CMyClass::OnClick
   // for the actual processing.
   LRESULT OnClick( ... )
   { ... }

};

See Also

Message Map Macros | ATL Macros | NOTIFY_ID_HANDLER | NOTIFY_CODE_HANDLER | REFLECTED_NOTIFY_CODE_HANDLER | NOTIFY_RANGE_HANDLER | COMMAND_HANDLER

Show:
© 2016 Microsoft