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 ( ) 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
::GetWindowTextbut 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
char *bufText = NULL;
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
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++