Click here to Skip to main content
Click here to Skip to main content

Display ToolTip in any place on the screen

, 1 Sep 2002
Rate this:
Please Sign up or sign in to vote.
This article shows how to display tooltips at any location on the screen

Sample ToolTip


This article shows how to display tooltips at any location on the screen.

To create a tooltip it is necessary to create a window of class TOOLTIPS_CLASS, then to fill a TOOLINFO structure:

typedef struct tagTOOLINFO{
	UINT      cbSize; 
	UINT      uFlags; 
	HWND      hwnd; 
	UINT_PTR  uId; 
	RECT      rect; 
	HINSTANCE hinst; 
	LPTSTR    lpszText; 
    #if (_WIN32_IE >= 0x0300)
	LPARAM lParam;

We determine two parameters in this structure which are interesting to us: uFlags and lpszText.

uFlags it is chosen equal TTF_TRACK, that gives us an opportunity of use message sending to choosing a position for ToolTip and control visibility.

lpszText - the task of the text which we want display.

Now we send the message in system, about desire to create the emerging help where we transfer the reference to our structure TOOLINFO

SendMessage (hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) *ti);

Then we send a TTM_TRACKPOSITION message  which sets the coordinates of ToolTip

SendMessage (hwndTT, TTM_TRACKPOSITION, 0, (LPARAM) (DWORD) MAKELONG (m_x, m_y));
where m_x and m_y coordinates x and y on the screen.

And finally we send the message to activate the ToolTip

SendMessage (hwndTT, TTM_TRACKACTIVATE, true, (LPARAM) (LPTOOLINFO) *ti);
where the true value indicates we will display the ToolTip. If we specified false, the ToolTip will be hidden.


1 Sep 2002 - updated source code


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Zarembo Maxim
Software Developer
Belarus Belarus
I work as the programmer. I live in Belarus in Minsk. At me higher education. I have experience development programs at use TCP/IP, Win32, MFC, HTTP, SNMP, HASP4, eToken, OpenGl, Hooks. Recently I use packages of development Visual Studio 6.0 and .Net.

Comments and Discussions

QuestionTooltip does not displays when I compile source code and run the program [modified] PinmemberAlwaysLearningNewStuff30-Jan-14 8:03 
AnswerRe: Tooltip does not displays when I compile source code and run the program PinmemberZarembo Maxim24-Jul-14 7:41 
GeneralGreat Job - clean concise source PinmemberMember 44391222-Nov-09 4:59 
GeneralEverything U need & Nothing U Don't Pinmemberpg--az24-Apr-09 19:23 
GeneralTo create Tooltip for picture control in MSVS 2008(VC++) Pinmembershruthikl26-Aug-08 1:03 
GeneralGDI OBJECT LEAK Pinmembercarloscorpia9-Mar-06 23:17 
GeneralDe source does not work... the sample exe does. PinmemberPeter Hendrix11-May-05 2:09 
GeneralRe: De source does not work... the sample exe does. PinmemberZarembo Maxim11-May-05 17:40 
GeneralRe: De source does not work... the sample exe does. [modified] PinmemberGMBarak16-Jan-07 20:10 
GeneralRe: De source does not work. vs manifest Pinmemberpg--az24-Apr-09 19:19 
GeneralMAHAssistance: a Nifty program that used this article (Thanks to Author) PinmemberBehzad Ebrahimi7-Nov-04 22:48 
GeneralRe: MAHAssistance: a Nifty program that used this article (Thanks to Author) PinmemberZarembo Maxim8-Nov-04 9:31 
GeneralThanks very much! PinmemberChris Hills7-Jul-04 5:04 
GeneralRe: Thanks very much! PinmemberZarembo Maxim29-Jul-04 1:21 
GeneralWrapping the text PinmemberBalkrishna Talele22-Apr-04 0:49 
GeneralRe: Wrapping the text PinmemberZarembo Maxim22-Apr-04 2:56 
GeneralUnregistering Tooltips rect PinmemberMajid Shahabfar16-Dec-02 1:28 
GeneralExcellent article Pinmemberdabs3-Sep-02 0:36 
GeneralAdding tooltip to picture control PinsussAnonymous2-Sep-02 0:38 
GeneralRe: Adding tooltip to picture control PinmemberChopper18-Dec-02 0:27 
Generalres directory missing from source PinmemberAndreas Saurwein1-Sep-02 22:59 
GeneralRe: res directory missing from source PinsussAnonymous1-Sep-02 23:47 
GeneralC++ .NET question PinsussAnonymous12-Aug-02 3:45 
GeneralRe: C++ .NET question PinsussAnonymous12-Aug-02 21:19 
GeneralRe: C++ .NET question PinsussAnonymous2-Sep-02 0:05 
GeneralRe: C++ .NET question PinmemberRedwings18-Sep-02 6:42 
GeneralRe: C++ .NET question PinsussAnonymous16-Oct-02 17:01 
GeneralRe: C++ .NET question PinmemberJaseNet2-Dec-04 23:51 
GeneralRe: C++ .NET question Pinmemberk_snow18-Jan-05 3:33 
GeneralRe: C++ .NET question Pinmemberpanzerdivisionmarkus22-Dec-05 4:44 
GeneralRe: C++ .NET question PinmemberMorten Fjeldstad25-Jan-06 0:44 
GeneralRe: C++ .NET question Pinmemberlin2alan15-Jun-06 17:20 
GeneralRe: C++ .NET question Pinmember_FKS_3-May-07 4:45 
GeneralRe: C++ .NET question Pinmemberzengkun1008-Dec-09 22:43 
GeneralGood Job! PinmemberEd Gadziemski11-Jun-02 2:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 2 Sep 2002
Article Copyright 2002 by Zarembo Maxim
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid