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. Restarting an application from within the same application

Restarting an application from within the same application

Scheduled Pinned Locked Moved C / C++ / MFC
c++designquestion
6 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.
  • L Offline
    L Offline
    ledallam
    wrote on last edited by
    #1

    Hi I am working in VC++ with an SDI application. I have button on my UI, on click of the button, I should close the application and i.e the executable and restart it again. Can anyone please give me some inputs for doing this? Thanks Madhavi

    G S 2 Replies Last reply
    0
    • L ledallam

      Hi I am working in VC++ with an SDI application. I have button on my UI, on click of the button, I should close the application and i.e the executable and restart it again. Can anyone please give me some inputs for doing this? Thanks Madhavi

      G Offline
      G Offline
      GDavy
      wrote on last edited by
      #2

      What about starting a intermediate app that just waits until the application has terminated and then launches that app again

      1 Reply Last reply
      0
      • L ledallam

        Hi I am working in VC++ with an SDI application. I have button on my UI, on click of the button, I should close the application and i.e the executable and restart it again. Can anyone please give me some inputs for doing this? Thanks Madhavi

        S Offline
        S Offline
        Smith
        wrote on last edited by
        #3

        (make a smal prgrm(Restarter.exe) to ShellExecute ur main appln , which after executing the main program gets closed) in the main appln's close event, shellexecute(Restarter.exe)before CDialog::OnClose(); in the startup of the Restarter.exe, ShellExecute(mainappln.exe) and issue ::close(); to terminate itself. may be a bad idea..:( but it'll work..:) regards, Rookie

        S 1 Reply Last reply
        0
        • S Smith

          (make a smal prgrm(Restarter.exe) to ShellExecute ur main appln , which after executing the main program gets closed) in the main appln's close event, shellexecute(Restarter.exe)before CDialog::OnClose(); in the startup of the Restarter.exe, ShellExecute(mainappln.exe) and issue ::close(); to terminate itself. may be a bad idea..:( but it'll work..:) regards, Rookie

          S Offline
          S Offline
          Smith
          wrote on last edited by
          #4

          use WinExec() regards, Rookie

          L 1 Reply Last reply
          0
          • S Smith

            use WinExec() regards, Rookie

            L Offline
            L Offline
            ledallam
            wrote on last edited by
            #5

            Hi, Thanks.. I am able to restart the application, but while closing it some threads are still running at the background. Can you pls help in shutting it down forcibily. Thanks Madhavi

            D 1 Reply Last reply
            0
            • L ledallam

              Hi, Thanks.. I am able to restart the application, but while closing it some threads are still running at the background. Can you pls help in shutting it down forcibily. Thanks Madhavi

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              See here for the proper way to shut down a thread.


              "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

              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