alaphate Posted May 24, 2012 Posted May 24, 2012 I'd like to retrieve all the windows having same class name "tooltips_class32"I used the win32 API function:hwndFound = FindWindowEx(NULL, NULL, "tooltips_class32", NULL);However, I could get only one window.Question is how to get all windows having the same class name.Another question is how to get the tooltip text?Using GetWindowText API, right?Thank you!
alaphate Posted May 24, 2012 Author Posted May 24, 2012 (edited) I used EnumWindow to retrieve all tooltip windows.Now the question is how to get the tooltip text given its HWND handle?I used TTM_GETTOOLINFO, but received nothing.#include <windows.h>#include <commctrl.h>void GetToolTipText(HWND hTooltip){ char szBuf[1024]={0}; TOOLINFO ti; ti.cbSize = sizeof(ti); ti.hwnd = GetParent(hTooltip); ti.uId = GetDlgCtrlID(hTooltip); ti.lpszText = szBuf; SendMessage(hTooltip, TTM_GETTOOLINFO, 0, (LPARAM)&ti); if(MessageBox(0, ti.lpszText, "tooltip", MB_YESNO) == IDNO) exit(0);} Edited May 24, 2012 by alaphate
enhzflep Posted May 27, 2012 Posted May 27, 2012 From a question I just read at stackOverflow (http://stackoverflow.com/questions/1333770/how-to-get-tooltip-text-for-a-given-hwnd) I'd imagine that you should send TTM_GETTEXT to the tool-tip windows.See more here: http://msdn.microsoft.com/en-us/library/bb760393%28VS.85%29.aspx (particularly, be careful on XP and below - there's no way to get or control the length of the returned text)
alaphate Posted May 28, 2012 Author Posted May 28, 2012 (edited) enhzflep,Thank you for replying my questions. You are awesome!The idea came from a tooltip fixer using:nircmd win settopmost class “tooltips_class32″ 1nircmd is nirsoft's command line toolWhen tooltip text is hidden by taskbar in windows xp.Now I can retrieve the id of tooltip control's, however, some id is zero.Still no tooltip text is retrieved.attachment is c++ source code.ThankstooltipText.zip Edited May 28, 2012 by alaphate
Departure Posted May 28, 2012 Posted May 28, 2012 enhzflep,Thank you for replying my questions. You are awesome!The idea came from a tooltip fixer using:nircmd win settopmost class “tooltips_class32″ 1nircmd is nirsoft's command line toolWhen tooltip text is hidden by taskbar in windows xp.Now I can retrieve the id of tooltip control's, however, some id is zero.Still no tooltip text is retrieved.attachment is c++ source code.ThanksTry postmessage instead of sendmessage Api..
Departure Posted May 28, 2012 Posted May 28, 2012 enhzflep,Thank you for replying my questions. You are awesome!The idea came from a tooltip fixer using:nircmd win settopmost class “tooltips_class32″ 1nircmd is nirsoft's command line toolWhen tooltip text is hidden by taskbar in windows xp.Now I can retrieve the id of tooltip control's, however, some id is zero.Still no tooltip text is retrieved.attachment is c++ source code.ThanksTry postmessage instead of sendmessage Api..
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now