question

amitlt avatar image
0 Votes"
amitlt asked Castorix31 answered

Finding a window in taskbar

Hi. Is there a way to find out a window handle of running app when mouse cursor is over app's taskbar button or app's group's taskbar button? Thanks.

windows-api-generalwindows-api-ui
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DavidLowndes-6766 avatar image
0 Votes"
DavidLowndes-6766 answered amitlt commented

See if this helps to answer your question.


· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It works, thanks.

0 Votes 0 ·

Although it works, I can't find out HWND exactly. Tried to get different properties of IUIAutomationElement without success. The only way I found by using get_CurrentName which is only a part of window title. Any ideas?

0 Votes 0 ·

Have you tried IUIAutomationElement::get_CachedNativeWindowHandle or IUIAutomationElement::get_CurrentNativeWindowHandle ?

0 Votes 0 ·
amitlt avatar image amitlt DavidLowndes-6766 ·

All calls to get_Cached* fail with E_INVALIDARGUMENT. Call to get_CurrentNativeWindowHandle returns 0 for any IUIAutomationElement.

0 Votes 0 ·
Show more comments
Castorix31 avatar image
0 Votes"
Castorix31 answered

There is a way by injecting a DLL to hook Explorer internal interfaces like CTaskItem/ITaskItem, CTaskGroup/ITaskGroup, but it is complex
You can see the method in taskbar_inspector.c


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.