Get balloon tips text of other applications.

shabbir's Avatar author of Get balloon tips text of other applications.
This is an article on Get balloon tips text of other applications. in MFC.
Rated 5.00 By 2 users

Introduction



How to get the balloon tips text displayed by other applications.

Background



I once wanted to get the Balloon Tips text and analyze what is the error caused the balloon tip to popuped and so wanted to get the frequency of such occurance. The existing application would not take the burden and so I needed a new Application which would do the task and I thought it to be a simple task where I will find the window and extract the window text using the GetWindowText API

Now the first question that came to my mind was what should I Find for. Spy ( ) gave me the answer and it should be Windows of class tooltips_class32

So I successfully found the Window Handle
HWND hWnd = ::FindWindow("tooltips_class32",NULL);

Then I thought its just one statement away ::GetWindowText but then the API did not return anything and I was just scratching my head.

Again getting the aspiration from Spy ( As it was showing the text I needed ) just thought of doing some more R&D and found out the solution.

Here it comes
Code: Cpp
char *bufText = NULL;
int iLen;

HWND hWnd = ::FindWindow("tooltips_class32",NULL); // Find the Tool Tip Window
iLen = ::SendMessage(hWnd,WM_GETTEXTLENGTH,0,0); // Send the Message to get the Text Length
bufText = new char[iLen]; // Allocate the buffer
::SendMessage(hWnd,WM_GETTEXT,(WPARAM)iLen,(LPARAM)bufText ); // Get the needed text
 
There is nothing thats done differently but remember that sometimes it get out of MFC to handle the code and you need to go back to basics i.e. Win32 way of getting text.

To display a balloon tip use Display a System Tray Icon in VC++ and use a new flag (available where _WIN32_IE >= 0x0500), NIF_INFO, which lets you display a balloon tip. The text goes in szInfo and the message in szInfoTitle.

References



Display a System Tray Icon in VC++
Newbie Member
29Aug2011,18:18   #2
ravi_18nov's Avatar
Hi Experts
I read your Article from which i could found tooltip text
Thanks a lot
But now I also want to reset that tooltips according to user
so am using following approach but I failed.. Plz Help me ...

::SendMessageW(hWndToolTip,WM_SETTEXT,(WPARAM)iToo lTipLen*5,(LPARAM)ToolTip_Unicode);


Whats going wrong with this code...plz provide the solution
Thanks a lot...