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. Windows Forms
  4. Only one Exe at an instance

Only one Exe at an instance

Scheduled Pinned Locked Moved Windows Forms
c++winformstutorialquestion
3 Posts 3 Posters 3 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.
  • P Offline
    P Offline
    pix_programmer
    wrote on last edited by
    #1

    Hi! I've developed an application using Windows Forms Managed C++. I've deployed it and installed at client systems. At present I can run many instances of my application at the same time. But I want only one at any particular instancde(ie. if I click the desktop short cut for my app,when already an instance is running, another instance of my app should not run). How to do this?

    L L 2 Replies Last reply
    0
    • P pix_programmer

      Hi! I've developed an application using Windows Forms Managed C++. I've deployed it and installed at client systems. At present I can run many instances of my application at the same time. But I want only one at any particular instancde(ie. if I click the desktop short cut for my app,when already an instance is running, another instance of my app should not run). How to do this?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Have you searched[^] at all, you got the keywords right? BTW: a second instance will run shortly, discover it isn't the first, possibly pass on the command line, then exit. :)

      Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      1 Reply Last reply
      0
      • P pix_programmer

        Hi! I've developed an application using Windows Forms Managed C++. I've deployed it and installed at client systems. At present I can run many instances of my application at the same time. But I want only one at any particular instancde(ie. if I click the desktop short cut for my app,when already an instance is running, another instance of my app should not run). How to do this?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Technically speaking, you cannot prevent a second instance from coming up, but you can code your app in such a way that it detects if an instance is already running and pass on the command-line arguments and then exit. There are many approaches to this, one is to use a Mutex and the other is to use the System.Diagnostics.Process class to check if the process is already running.

        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