E235
E235

Reputation: 13400

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

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

Upvotes: 5

Views: 4222

Answers (1)

E235
E235

Reputation: 13400

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;
}

Upvotes: 6

Related Questions