TTM_SETTITLE message

Adds a standard icon and title string to a tooltip.

Parameters

wParam

Set wParam to one of the following values to specify the icon to be displayed. As of Windows Vista and later, this parameter can also contain an HICON value. Any value greater than TTI_ERROR_LARGE is assumed to be an HICON.

Value Meaning
TTI_NONE
No icon.
TTI_INFO
Info icon.
TTI_WARNING
Warning icon
TTI_ERROR
Error Icon
TTI_INFO_LARGE
Large error Icon
TTI_WARNING_LARGE
Large error Icon
TTI_ERROR_LARGE
Large error Icon

lParam

Pointer to the title string. You must assign a value to lParam.

Return value

Returns TRUE if successful, FALSE if not.

Remarks

The title of a tooltip appears above the text, in a different font. It is not sufficient to have a title; the tooltip must have text as well, or it is not displayed.

When wParam contains an HICON, a copy of the icon is created by the tooltip window.

When calling TTM_SETTITLE, the string pointed to by lParam must not exceed 100 TCHARs in length, including the terminating NULL.

Examples

The following example shows how to add a title and a system icon to a tooltip.

// hwndTip is the handle of the tooltip window.
HICON hIcon = LoadIcon(NULL, IDI_INFORMATION);
SendMessage(hwndTip, TTM_SETTITLE, (WPARAM)hIcon, L"Title text");
DestroyIcon(hIcon);

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Commctrl.h
Unicode and ANSI names
TTM_SETTITLEW (Unicode) and TTM_SETTITLEA (ANSI)

See also

About Tooltip Controls