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

Restarting the Application

Scheduled Pinned Locked Moved C / C++ / MFC
questionjson
7 Posts 3 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.
  • A Offline
    A Offline
    Ali Tavakol
    wrote on last edited by
    #1

    Hi All! How can I restart my application by API functions?

    M O 2 Replies Last reply
    0
    • A Ali Tavakol

      Hi All! How can I restart my application by API functions?

      M Offline
      M Offline
      M Mehrdad M
      wrote on last edited by
      #2

      I Think There is no Direct Way. One Way Is To Execte Program in A Batch File (.bat or .cmd) And Check The Exit Value of App. if You want To Restart App from Other App.(i.e. A Service) You can use TerminateProcess() API And spawn() or Other Execution Function(Execute(), ....)

      A 1 Reply Last reply
      0
      • A Ali Tavakol

        Hi All! How can I restart my application by API functions?

        O Offline
        O Offline
        Owner drawn
        wrote on last edited by
        #3

        Do you want to restart the application from this application itself?

        Jesus Loves:rose:

        --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

        A 1 Reply Last reply
        0
        • O Owner drawn

          Do you want to restart the application from this application itself?

          Jesus Loves:rose:

          --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

          A Offline
          A Offline
          Ali Tavakol
          wrote on last edited by
          #4

          Yes, of course!

          O 1 Reply Last reply
          0
          • M M Mehrdad M

            I Think There is no Direct Way. One Way Is To Execte Program in A Batch File (.bat or .cmd) And Check The Exit Value of App. if You want To Restart App from Other App.(i.e. A Service) You can use TerminateProcess() API And spawn() or Other Execution Function(Execute(), ....)

            A Offline
            A Offline
            Ali Tavakol
            wrote on last edited by
            #5

            And Check The Exit Value of App How to do this? please give an example.

            M 1 Reply Last reply
            0
            • A Ali Tavakol

              Yes, of course!

              O Offline
              O Offline
              Owner drawn
              wrote on last edited by
              #6

              Yeah I have done that in VB.net many times. And in VC++ it must be easy too. Close all open streams, handles, and whatever resources that you are using. Equivalent to shutting down of the application but not really shutting down. Now start up your application with ShellExecute... And immediately after that quit your application. It will work.

              Jesus Loves:rose:

              --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

              1 Reply Last reply
              0
              • A Ali Tavakol

                And Check The Exit Value of App How to do this? please give an example.

                M Offline
                M Offline
                M Mehrdad M
                wrote on last edited by
                #7

                if your app is in console mode, main function returns an integer value, that is placed in errorlevel variable, that can be check in a bath file M.Mehrdad.M

                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