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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. restarting a program

restarting a program

Scheduled Pinned Locked Moved C / C++ / MFC
mcphelptutorial
4 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.
  • D Offline
    D Offline
    dennisV
    wrote on last edited by
    #1

    I also need help on how to restart a program from within itself... Basically I have a need to reload my program from scratch if a user changes some options. I'm not sure how to accomplish that, so any suggestions or hints would be really helpful! Thanks in advance, Dennis MCP, MCSD

    B 1 Reply Last reply
    0
    • D dennisV

      I also need help on how to restart a program from within itself... Basically I have a need to reload my program from scratch if a user changes some options. I'm not sure how to accomplish that, so any suggestions or hints would be really helpful! Thanks in advance, Dennis MCP, MCSD

      B Offline
      B Offline
      benjymous
      wrote on last edited by
      #2

      Can't you just make it ShellExecute it's own exe (passing down any command line options if appropriate) and then quit the original? -- Help me! I'm turning into a grapefruit!

      D 1 Reply Last reply
      0
      • B benjymous

        Can't you just make it ShellExecute it's own exe (passing down any command line options if appropriate) and then quit the original? -- Help me! I'm turning into a grapefruit!

        D Offline
        D Offline
        dennisV
        wrote on last edited by
        #3

        Strangely enough, it works! I just didn't think of that option because I am limiting my application to one instance only in InitInstance and I thought that the thread wouldn't be destroyed as fast as it does and it would block the launch of a new one. But it doesn't. Thanks. MCP, MCSD

        B 1 Reply Last reply
        0
        • D dennisV

          Strangely enough, it works! I just didn't think of that option because I am limiting my application to one instance only in InitInstance and I thought that the thread wouldn't be destroyed as fast as it does and it would block the launch of a new one. But it doesn't. Thanks. MCP, MCSD

          B Offline
          B Offline
          benjymous
          wrote on last edited by
          #4

          Hmm, in that case it's worth testing rigourously (especially on slower machines) as it may end up failing some of the time. Another solution would just to be to run a secondary application (or batch file) that's job is to just pause until the main app is quit, and then relaunch it -- Help me! I'm turning into a grapefruit!

          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