windowswinapiwtl

Tooltip text truncated


I found out that sometimes, the text on my tooltip is not fully displayed. Here's an example for such text:

WWWWW WWWW, WW WWWWWWWW

WWWWWWWWWW WWWWWWWWWWWWW WWWWWWWWW

Screenshot:

screenshot

My tooltip creation code (WTL):

CToolTipCtrl tooltip;
TOOLINFO toolInfo;

tooltip.Create(window, NULL, NULL, TTS_NOFADE);

toolInfo = CToolInfo(TTF_IDISHWND | TTF_TRACK | TTF_ABSOLUTE, 
    tooltip, 0, NULL, L"WWW...");

tooltip.AddTool(&toolInfo);

tooltip.SendMessage(TTM_SETTITLE, (WPARAM)hIcon, (LPARAM)L"Title");

Is it a known issue? Any help is appreciated. Thanks!


Solution

  • Looks like calling tooltip.SetMaxTipWidth(MAXINT); fixes it.

    Non-WTL version: SendMessage(..., TTM_SETMAXTIPWIDTH, 0, MAXINT);