Hello again!
Well, findings enough. First I dived into the AutoIt manual, I've wanted to familiarize myself with it's API and this was a good opportunity. I must say I'm thoroughly impressed, although not as powerful as my usual tools of automation (Python, Perl, sh, etc.) in some areas. But it can do some unique things they can't and I'm definitely seeing lots of potential!
Ok, back to the system tray problem. Here are a few findings on that:
- The Notification Area (actual name) is a
control of the Desktop process (Explorer). It's not a separate process, nor is it a separate window.
- The icons themselves are also controls of Explorer, not separate processes or windows.
- Processes with an icon in the Notification Area are not necessarily child-processes of Explorer. Nor do they need to have a window.
Now, in AutoIt I can access said Notification Area control and get a correct number count of the icons, both visible and hidden. So far no worries. But thus far I've been unable to retrieve the underlying processes of the icon controls. AutoIt forum searches do seem to hint that it can be done, but so far I've been unable to do so. Maybe it's because I'm on Win 7
64-bit. Either way, I can't get any of those code snippets to work, they all report only one process (AutoIt3.exe) and that's not even in the Notification Area!
Add to that the fact that Win 7 seems to introduce it's own unique set of problems (why am I not surprised...) regardless of it's bitness and my relative unfamiliarity with the WINApi and you can see I'm a bit lost at the moment... Btw, most topics seem to hint that it's relatively easy with DLL injection, but that's just... dirty.
And that's only half of the problem. Even if I can access the underlying processes, how do I reattach them to the Notification Area after a crash
without a forced restart? I haven't looked into that yet (tackling one problem at a time) but I'm sure it won't be as easy as Shell_NotifyIcon(icon, process, other, arguments, here)... A forced restart of all processes would be no problem but not what you were looking for.
Can it be done? Yes. I mean if PS Tray Factory can do it, it must be possible, right? Can it be done in AutoIt? Well, probably, but it's way beyond the intended use of AutoIt and I am convinced that doing it in C will be not only much easier, the result will also be faster and more stable, DLL injection or not.
tl;dr
So, no luck so far. But 'Systray Restore' has become something of a pet project of mine and I'll certainly keep my eyes open for any possible solutions. If you don't mind a forced restart it would cut the problem in half

And atleast I'm learning AutoIt thanks to you
