Single Instance
-
Hi all, I have an application which will be installed on the user machine. The application has two main parts. First application checks for the new updates from the server and then invokes the other application using the dll. The second application is what the user actually interact with. The application minimizes to the system tray. The user may close or minimize the form that is displayed. My main objective here is if the application is running and the user again clicks on the Shortcut that is placed on the desktop. The form that is minimized or was closed should be displayed. How do i do this? Hope i have put the problem properly to everyones understanding.
Thanks & Regards, Pramod "Everyone is a genius at least once a year"
-
Hi all, I have an application which will be installed on the user machine. The application has two main parts. First application checks for the new updates from the server and then invokes the other application using the dll. The second application is what the user actually interact with. The application minimizes to the system tray. The user may close or minimize the form that is displayed. My main objective here is if the application is running and the user again clicks on the Shortcut that is placed on the desktop. The form that is minimized or was closed should be displayed. How do i do this? Hope i have put the problem properly to everyones understanding.
Thanks & Regards, Pramod "Everyone is a genius at least once a year"
Hi Yadav Guess the following 2 links will help you. http://msdn.microsoft.com/msdnmag/issues/05/09/NETMatters/ http://www.codeproject.com/threads/simplesingleinstanceapp.asp Thanks and Regards Pani
-
Hi Yadav Guess the following 2 links will help you. http://msdn.microsoft.com/msdnmag/issues/05/09/NETMatters/ http://www.codeproject.com/threads/simplesingleinstanceapp.asp Thanks and Regards Pani
-
Hi all, I have an application which will be installed on the user machine. The application has two main parts. First application checks for the new updates from the server and then invokes the other application using the dll. The second application is what the user actually interact with. The application minimizes to the system tray. The user may close or minimize the form that is displayed. My main objective here is if the application is running and the user again clicks on the Shortcut that is placed on the desktop. The form that is minimized or was closed should be displayed. How do i do this? Hope i have put the problem properly to everyones understanding.
Thanks & Regards, Pramod "Everyone is a genius at least once a year"
Does the shortcut point to the actual application or the "launcher" application? Either way, you could check for the existence of the process first off and switch focus to it if you find it running. Something like
bool IsProcessAlreadyRunning(string processName)
{
Process[] processes = Process.GetProcesses(processName);
return (processes != null && processes.Length != 0);
}If the above method returns true, you know that an instance of the process is already running. You could then use the MainWindowHandle[^] of the corresponding
Process
object to get the window handle and P/Invoke some Win32 API (Activate?) to bring the existing process' window into focus. Hope this helps.Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro