Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm 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?

Posted
I'm 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 don't have to save the window's handle to text file in my install directory when minimzed. Then a 2nd instance can check if it's already running and use the handle from the file to show the 1st instance...

Posted
Someone please tell me I don't have to save the window's handle to text file in my install directory when minimzed. Then a 2nd instance can check if it's already running and use the handle from the file to show the 1st instance...

Of course you don't, 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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...