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. self update exe?

self update exe?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionannouncement
3 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.
  • T Offline
    T Offline
    ThinkingPrometheus
    wrote on last edited by
    #1

    hiho@ll anyone knows how to write a exe which is currently running? what i need: solution 1: 1. execute test.exe 2. download updated test.exe 3. overwrite test.exe with the updated test.exe solution 2: i know i could download in a temporary directory create a bat file close my application and execute bat file, which copys the exe, executes the new exe and deletes itself (test.bat) but, how i can execute the bat file and make sure the test.exe application is closed so i can overwrite it with the downloaded? OR is there a way to do it like solution 1? thx@ll

    D 1 Reply Last reply
    0
    • T ThinkingPrometheus

      hiho@ll anyone knows how to write a exe which is currently running? what i need: solution 1: 1. execute test.exe 2. download updated test.exe 3. overwrite test.exe with the updated test.exe solution 2: i know i could download in a temporary directory create a bat file close my application and execute bat file, which copys the exe, executes the new exe and deletes itself (test.bat) but, how i can execute the bat file and make sure the test.exe application is closed so i can overwrite it with the downloaded? OR is there a way to do it like solution 1? thx@ll

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

      A slight twist to solution 1: 1. execute test.exe 2. test.exe executes checkupd.exe 3. checkupd.exe checks for updates. 4. if any are found: 4a. terminate test.exe 4b. download test.exe 4c. execute new test.exe 5. checkupd.exe is ended Otherwise if you must do everything from within test.exe, check out the MoveFileEx(..., MOVEFILE_DELAY_UNTIL_REBOOT) function.


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      S 1 Reply Last reply
      0
      • D David Crow

        A slight twist to solution 1: 1. execute test.exe 2. test.exe executes checkupd.exe 3. checkupd.exe checks for updates. 4. if any are found: 4a. terminate test.exe 4b. download test.exe 4c. execute new test.exe 5. checkupd.exe is ended Otherwise if you must do everything from within test.exe, check out the MoveFileEx(..., MOVEFILE_DELAY_UNTIL_REBOOT) function.


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        S Offline
        S Offline
        scott sanders
        wrote on last edited by
        #3

        I do something similar to this for getting my programs to update themselves from the web. But I use an MSI for distribution so that is the second program in the scenario. I like your solution because you can easily execute the updated program when it has finished. My method was: 1. Check for updates 2. If any found, confirm and download into user Temp directory 3. ShellExecute the MSI package (/qb) just downloaded 4. PostQuitMessage on self The installer updates the program and then leaves the user back at the desktop. I never thought of a good way to restart the application. I might try something like yours next time.

        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