Jump to content
Tuts 4 You

How to get all windows handles having same class name?


alaphate

Recommended Posts

Posted

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!

Posted (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 by alaphate
Posted (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″ 1

nircmd is nirsoft's command line tool

When 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.

Thanks

tooltipText.zip

Edited by alaphate
Posted

enhzflep,

Thank you for replying my questions. You are awesome!

The idea came from a tooltip fixer using:

nircmd win settopmost class “tooltips_class32″ 1

nircmd is nirsoft's command line tool

When 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.

Thanks

Try postmessage instead of sendmessage Api..

Posted

enhzflep,

Thank you for replying my questions. You are awesome!

The idea came from a tooltip fixer using:

nircmd win settopmost class “tooltips_class32″ 1

nircmd is nirsoft's command line tool

When 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.

Thanks

Try postmessage instead of sendmessage Api..

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...