Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. controlled launching of multiple instances

controlled launching of multiple instances

Scheduled Pinned Locked Moved C#
csharptutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KrunalC
    wrote on last edited by
    #1

    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

    L G P 3 Replies Last reply
    0
    • K KrunalC

      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

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      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 --

      K 1 Reply Last reply
      0
      • L led mike

        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 --

        K Offline
        K Offline
        KrunalC
        wrote on last edited by
        #3

        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.

        L 1 Reply Last reply
        0
        • K KrunalC

          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.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          KrunalC wrote:

          I viewed the article you have given prior posting my question.

          Yes sorry, that was not helpful, try looking at the System.Threading.Mutex class. I have not proven it but I suspect it could be used to fulfill your requirements.

          1 Reply Last reply
          0
          • K KrunalC

            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

            G Offline
            G Offline
            Giorgi Dalakishvili
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • K KrunalC

              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

              P Offline
              P Offline
              pbraun
              wrote on last edited by
              #6

              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

              K 1 Reply Last reply
              0
              • P pbraun

                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

                K Offline
                K Offline
                KrunalC
                wrote on last edited by
                #7

                Pbraun, Thanks for your response. Instances to be launched on the same system only. I have two different operating modes in which my application works. Pls revert with your idea or questions if any. regards, Krunal C

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups