Handle of application minimized to tray is 0!??

kasdoffe

Well-known member
Joined
Aug 27, 2003
Messages
57
Im trying to check if my application is already running in the system tray and if it is then bring it back to focus when I try to start a 2nd instance of my application.

However, through some testing it appears that an application that is minimized to the system tray and not shown in the taskbar has no MainWindowHandle that can be used through an API to bring focus back to it? The MainWindowHandle of the process is 0.

How can I bring focus back to the already running, minimized-to-tray application?
 
kasdoffe said:
Im trying to check if my application is already running in the system tray and if it is then bring it back to focus when I try to start a 2nd instance of my application.

However, through some testing it appears that an application that is minimized to the system tray and not shown in the taskbar has no MainWindowHandle that can be used through an API to bring focus back to it? The MainWindowHandle of the process is 0.

How can I bring focus back to the already running, minimized-to-tray application?

Someone please tell me I dont have to save the windows handle to text file in my install directory when minimzed. Then a 2nd instance can check if its already running and use the handle from the file to show the 1st instance...
 
kasdoffe said:
Someone please tell me I dont have to save the windows handle to text file in my install directory when minimzed. Then a 2nd instance can check if its already running and use the handle from the file to show the 1st instance...
Of course you dont, that would be a daft way to implement the functionality you want. Use remoting, send a message to the minimized app telling it to restore itself, no windows handles or native apis needed.
 
Back
Top