Processing Tooltip Notification Messages

A toolbar that has the TBSTYLE_TOOLTIPS style creates a tooltip control, which an application can use to display help text for toolbar buttons. The parent window receives the TTN_NEEDTEXT notification message when the toolbar needs the help text for a button. The tooltip sends the notification in the form of a WM_NOTIFY message. The lParam parameter includes the address of a TOOLTIPTEXT structure that specifies the command identifier of the button for which help text is needed. An application can copy the help text to the structure, specify the address of a string containing the help text, or specify the instance handle and resource identifier of a string resource.

The following example demonstrates how to process the TTN_NEEDTEXT notification.

case WM_NOTIFY:

switch (((LPNMHDR) lParam)->code) {

case TTN_NEEDTEXT:

{

LPTOOLTIPTEXT lpttt;

lpttt = (LPTOOLTIPTEXT) lParam;

lpttt->hinst = g_hinst;

// Specify the resource identifier of the descriptive

// text for the given button.

idButton = lpttt->hdr.idFrom;

switch (idButton) {

case IDM_CUT:

lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_CUT);

break;

case IDM_COPY:

lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_COPY);

break;

case IDM_PASTE:

lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_PASTE);

break;

}

break;

}

.

. // Process other notifications here.

.

default:

break;

}

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database