Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/articles/mfc-tutorials/)
-   -   Get balloon tips text of other applications. (http://www.go4expert.com/articles/balloon-tips-text-applications-t10639/)

shabbir 16May2008 16:31

Get balloon tips text of other applications.


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


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 ( :whip: ) 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. :2thumbsup

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.


Display a System Tray Icon in VC++

ravi_18nov 29Aug2011 18:18

Re: Set balloon tips text of other applications.
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...

All times are GMT +5.5. The time now is 04:06.