controlled launching of multiple instances
-
I have a c# application which can be launched in different modes. Multiple instances of this application can be launched provied no other instance of the application is running with the same mode. e.g. My c# application can work in two different modes say 1. abc 2. xyz What I want is when I try to launch my application in "abc" mode, before launching the application, it should check whether any other instance of the application with "abc" mode is running or not. If instance with "abc" mode is running then running instance will be returned else new instance with mode "abc" will be launched. There is mechanism in my application through which I can set the mode prior launching the application. As of now, I don't have any idea on how to implement this requirement. I'm seeking some ideas and suggestions on how I can implement such requirement. Thanks Krunal C
-
I have a c# application which can be launched in different modes. Multiple instances of this application can be launched provied no other instance of the application is running with the same mode. e.g. My c# application can work in two different modes say 1. abc 2. xyz What I want is when I try to launch my application in "abc" mode, before launching the application, it should check whether any other instance of the application with "abc" mode is running or not. If instance with "abc" mode is running then running instance will be returned else new instance with mode "abc" will be launched. There is mechanism in my application through which I can set the mode prior launching the application. As of now, I don't have any idea on how to implement this requirement. I'm seeking some ideas and suggestions on how I can implement such requirement. Thanks Krunal C
See if this article helps[^] Sorry, forget that article see if the System.Threading.Mutex[^] class will get you there.
Last modified: 5mins after originally posted --
-
See if this article helps[^] Sorry, forget that article see if the System.Threading.Mutex[^] class will get you there.
Last modified: 5mins after originally posted --
mike, Thanks for your reply. I viewed the article you have given prior posting my question. But the article only mentions how to prohibit multiple launching of the application. In my case I have to check the mode of the application prior allowing or prohibiting my application. So I'm confused how I can store application mode related information and how I can validate this information prior launching my application. Hope now my question is more clear.
-
mike, Thanks for your reply. I viewed the article you have given prior posting my question. But the article only mentions how to prohibit multiple launching of the application. In my case I have to check the mode of the application prior allowing or prohibiting my application. So I'm confused how I can store application mode related information and how I can validate this information prior launching my application. Hope now my question is more clear.
-
I have a c# application which can be launched in different modes. Multiple instances of this application can be launched provied no other instance of the application is running with the same mode. e.g. My c# application can work in two different modes say 1. abc 2. xyz What I want is when I try to launch my application in "abc" mode, before launching the application, it should check whether any other instance of the application with "abc" mode is running or not. If instance with "abc" mode is running then running instance will be returned else new instance with mode "abc" will be launched. There is mechanism in my application through which I can set the mode prior launching the application. As of now, I don't have any idea on how to implement this requirement. I'm seeking some ideas and suggestions on how I can implement such requirement. Thanks Krunal C
Mutex class can help you. If the mode of your application cannot be changed by the user while it is running, then you can create one mutex for "abc" mode and another one for "xyz" mode. For an example of using mutex class to restrict multiple instances have a look at Making the application single-instance section at Window tray minimizer[^]
#region signature my articles #endregion
-
I have a c# application which can be launched in different modes. Multiple instances of this application can be launched provied no other instance of the application is running with the same mode. e.g. My c# application can work in two different modes say 1. abc 2. xyz What I want is when I try to launch my application in "abc" mode, before launching the application, it should check whether any other instance of the application with "abc" mode is running or not. If instance with "abc" mode is running then running instance will be returned else new instance with mode "abc" will be launched. There is mechanism in my application through which I can set the mode prior launching the application. As of now, I don't have any idea on how to implement this requirement. I'm seeking some ideas and suggestions on how I can implement such requirement. Thanks Krunal C
-
Are the multiple instances of the application to be launched on the same system or networked computers? How many different operating modes are allowed? Two? More than two?
Phil