Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get hidden windows handle of the windows that show hidden system tray icons

Tags:

c++

c#

winapi

spy++

I am trying to write application in C# that catch the handle of the hidden windows that appear when pressing the button ("Show hidden icons").

When we don't show all the notification area we have hidden system tray icons.

When we press on the button ("Show hidden icons") that show them we have a new window that all the icons inside it:
enter image description here
The hidden windows marked with green circle

How can I catch the handle of this hidden window ?

When I used Spy++ I couldn't find this window because the windows dissapears when I click any other key on the keyboard.

So I found the handle of the button and used the logging option:
enter image description here

In the logging results I only saw windows handles of the regular system tray tool bar:
enter image description here

So how can I catch the handle of the hidden window (the one I marked with green in the begging of my question, first pictuare).

References (links I found but didn't help me):
How to capture Notification icons properties using Microsoft Spy++
Get information about hidden tray icons in windows7

like image 982
E235 Avatar asked Sep 26 '22 04:09

E235


1 Answers

I succeed !

I succeed to catch it with Spy++:

enter image description here

enter image description here

Code solution:

static IntPtr GetHiddenSystemTrayHandle()
{
    IntPtr hWndTray = User32.FindWindow("NotifyIconOverflowWindow", null);
    if (hWndTray != IntPtr.Zero)
    {
            if (hWndTray != IntPtr.Zero)
            {
                // Windows caption "Overflow Notification Area"
                hWndTray = User32.FindWindowEx(hWndTray, IntPtr.Zero, "ToolbarWindow32", null);
                return hWndTray;
            }
    }

    return IntPtr.Zero;
}
like image 116
E235 Avatar answered Sep 30 '22 06:09

E235