views:

96

answers:

3

Is it possible to restore a 3rd Party application which has been minimized to the SysTray?

Calling ShowWindow is fine on apps minimized to the TaskBar but where the app has been minimized to the SysTray it appears its handle gets set to zero, and of course ShowWindow can't find it.

+2  A: 

No; there are different approaches that can be taken to accomplish this (the application might close the window and open a new copy when restoring, or it might simply hide the original window and show it upon restoring). There is no particular process that an application needs to follow in order to achieve this functionality, so there's no particular process that can be followed in order to reverse it.

If you have information about how a particular application behaves and you'd like to deal with it as a specific case, then that might be possible. But a one-size-fits-all solution unfortunately doesn't exist.

Edit

You can try using Process Explorer to determine what (if any) window handles are open by the process. This will at least tell you if it's destroying or hiding the window.

Adam Robinson
It's a specific app I am targeting
hawbsl
@hawbsl: That's better, but you'd need to know exactly how that application works in order for that to be helpful. See the edit.
Adam Robinson
helpful advice, thanks. Downloaded Process Explorer and had a look
hawbsl
+1  A: 

It is entirely dependent on the app's implementation. The far more common approach would be for it to create a new window from scratch instead of showing a hidden one.

It gets its tray icon notifications through a private callback function, you can't fake that yourself. Faking a mouse click is very hard to get right because you can't find out where the icon is located. I think you're stuck.

Hans Passant
helpful advice, thanks.
hawbsl
A: 

Helpful advice from Adam Robinson and nobugz. Helped me to see that what we are attempting might not even be possible. Too much depends on how the app is behaving internally when it hides itself and we don't control that or even know much about it. We needed to approach this from another direction.

The app sits in the SysTray waiting to be activated via the user mouse clicking on it, but we can't automate that. But there's another way of "activating" the app and that's by running the exe file again. In this case, that doesn't start a second instance, it just reactivates the existing instance. So why not Shell out to the exe file and reactivate the app that way? That's what we did and it is a working solution.

hawbsl