5

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

Community
  • 1
  • 1
E235
  • 11,560
  • 24
  • 91
  • 141
  • What do you want to do once you have the window handle? – andlabs Nov 18 '15 at 14:21
  • @andlabs I want to find the associated processes to these icons. I know how to do it on the visibels icons: http://stackoverflow.com/questions/33652756/how-to-get-the-processes-that-have-systray-icon – E235 Nov 18 '15 at 14:24
  • @E235: And why do you believe that the (unrelated) window created by the shell would be of any help? It is merely the host window for the icons. It's the icons in the notification area, that know, which window to notify. – IInspectable Nov 18 '15 at 14:26
  • @IInspectable because I succeed to do it on the visibles icons http://stackoverflow.com/questions/33781788/how-to-get-hidden-windows-handle-of-the-windows-that-show-hidden-system-tray-ico?noredirect=1#comment55331790_33781788 when I had the handle of the windows the icons appeared on. So I believe that once I will find the handle of the hidden window I will be able to find them in the same way – E235 Nov 18 '15 at 14:30
  • So much hackery, it hurts. Access to the visible notification area icons is offered through an [official interface](http://stackoverflow.com/a/7383129/1889329). The hidden icons - as the name implies - are hidden. You won't get access to those. – IInspectable Nov 18 '15 at 14:50
  • @IInspectable They are hidden but it doesn't mean they are not there. If the button that show them can, we also can. Understanding to what windows this button points can help also. – E235 Nov 18 '15 at 15:07
  • @E235: For all we know the chevron button could create the window on demand, and destroy it when dismissed. Your chain of reasoning is not convincing. – IInspectable Nov 18 '15 at 15:17

1 Answers1

6

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;
}
E235
  • 11,560
  • 24
  • 91
  • 141