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 / C++ / MFC
  4. Stopping an application...

Stopping an application...

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
5 Posts 2 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.
  • R Offline
    R Offline
    Roger
    wrote on last edited by
    #1

    I want to add the capability to my dialog based application so when I start it, it looks to see if any other instances of the application are running. If there is one already running, that instance will be killed and the new instance will be started. How can I do this, I know I have seen it on here before but cannot find the solution. Any help? Roger Printy Software Engineer TeraNex Orlando, FL

    T 1 Reply Last reply
    0
    • R Roger

      I want to add the capability to my dialog based application so when I start it, it looks to see if any other instances of the application are running. If there is one already running, that instance will be killed and the new instance will be started. How can I do this, I know I have seen it on here before but cannot find the solution. Any help? Roger Printy Software Engineer TeraNex Orlando, FL

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      So what's exactly is the problem? Determining if another instance is running, or terminating it cleanly? Tomasz Sowinski -- http://www.shooltz.com.pl

      R 1 Reply Last reply
      0
      • T Tomasz Sowinski

        So what's exactly is the problem? Determining if another instance is running, or terminating it cleanly? Tomasz Sowinski -- http://www.shooltz.com.pl

        R Offline
        R Offline
        Roger
        wrote on last edited by
        #3

        Both really. Like I said, I have done it before just cannot find the source code I used. Roger Printy Software Engineer TeraNex Orlando, FL

        T 1 Reply Last reply
        0
        • R Roger

          Both really. Like I said, I have done it before just cannot find the source code I used. Roger Printy Software Engineer TeraNex Orlando, FL

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          The following article by PJ Naughter deals with "single-instancing": http://www.codeproject.com/cpp/csingleinst.asp However, the code you'll find there closes the second instance (not the original one). To close the original instance, you can send a message to its main window. WM_CLOSE could work here, depending on the actions your program performs on closing. If any msgboxes are displayed (prompt for save, etc.), you can choose to use some private application message. Tomasz Sowinski -- http://www.shooltz.com.pl

          R 1 Reply Last reply
          0
          • T Tomasz Sowinski

            The following article by PJ Naughter deals with "single-instancing": http://www.codeproject.com/cpp/csingleinst.asp However, the code you'll find there closes the second instance (not the original one). To close the original instance, you can send a message to its main window. WM_CLOSE could work here, depending on the actions your program performs on closing. If any msgboxes are displayed (prompt for save, etc.), you can choose to use some private application message. Tomasz Sowinski -- http://www.shooltz.com.pl

            R Offline
            R Offline
            Roger
            wrote on last edited by
            #5

            Works like a dream, it really did not matter which one was closed, probably better to have the new instance stopped rather than the last instance. Thanks! Roger Printy Software Engineer TeraNex Orlando, FL

            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