Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.94 KB

handling-ttn-needtext-notification-for-tool-tips.md

File metadata and controls

45 lines (29 loc) · 1.94 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Handling TTN_NEEDTEXT Notification for Tool Tips
Handling TTN_NEEDTEXT Notification for Tool Tips
11/04/2016
TTN_NEEDTEXT
TTN_NEEDTEXT message [MFC]
notifications [MFC], tool tips
tool tips [MFC], notifications
d0370a65-21ba-4676-bcc5-8cf851bbb15c

Handling TTN_NEEDTEXT Notification for Tool Tips

As part of enabling tool tips, you handle the TTN_NEEDTEXT message by adding the following entry to your owner window's message map:

[!code-cppNVC_MFCControlLadenDialog#40]

memberFxn
The member function to be called when text is needed for this button.

Note that the ID of a tool tip is always 0.

Declare your handler function in the class definition as follows:

[!code-cppNVC_MFCControlLadenDialog#53]

where the italicized parameters are:

id
Identifier of the control that sent the notification. Not used. The control id is taken from the NMHDR structure.

pNMHDR
A pointer to the NMTTDISPINFO structure. This structure is also discussed further in The TOOLTIPTEXT Structure.

pResult
A pointer to result code you can set before you return. TTN_NEEDTEXT handlers can ignore the pResult parameter.

As an example of a form-view notification handler:

[!code-cppNVC_MFCControlLadenDialog#54]

Call EnableToolTips (this fragment taken from OnInitDialog):

[!code-cppNVC_MFCControlLadenDialog#55]

See also

Tool Tips in Windows Not Derived from CFrameWnd