I run/lunch my old desktop application after that i clicked a button for check the new version of that software is exists or not. If i am getting any new version then i want to replace the old one with new one and invoke the latest exe for open the App.

So how could i run the newer version and delete/replace the old one ?Note : Old exe is running.

In the implementation that I have posted here following the download the current running program quits and the downloaded file is launched.

On the Mac there are two types of downloadable files, the DMG and a PKG. A DMG will open and allow the user to drag and drop the latest version where he wants and the PKG will run an installer similar in use to the Windows installer.

On the Windows platform there are ZIP and EXE files. Typically an EXE file is an installer that will run and install the program over the last version.

I assume your question is coming from the Windows area. If you are deploying an app on that platform you should be using either an executable zip file that will place the files in the right places automatically or an installer. I assume that you don't want your users to manually install the application. This means that you should invest some time (and maybe some money) in a good installer. The best free installer that I used to use when I worked on the Windows platform was Inno Setup. Do a web search for this.

In the implementation that I have posted here following the download the current running program quits and the downloaded file is launched.

I used the above or same logic for software updation. I used the monkeyrealsoftware for download the zip file from the ftp server and Unzip that file and quit the old exe and launch the new one. But My problem is while i Unzipping the file using the monkeyrealsoftware component, it's unzip the file after that the below line of code is not executed.

Could you please tell me what is the problems behind this.

Note : In Run time its working fine but when create a exe then run that app its not working

I used the above or same logic for software updation. I used the monkeyrealsoftware for download the zip file from the ftp server and Unzip that file and quit the old exe and launch the new one. But My problem is while i Unzipping the file using the monkeyrealsoftware component, it's unzip the file after that the below line of code is not executed.

I do not use the monkeybread components so I would suggest that you contact them.

if TargetFile.Exists then TargetFile.Deleteif TargetFile.LastErrorCode <> 0then// there is an error

An example is the case that you have downloaded the installer file and it has opened but not yet installed. You then restart the program and restart the download you have a locked existing file which can not be deleted nor overwritten. Without checking for an error, the software will hang unless a cancel download is implemented.

I modified the check for version:

// now check for updates being available:if major> app.MajorVersion then// major update available canupdate = trueelse// no major update, so check that at least major version is the same before checking for minor versionif major > app.majorversion then// check for minor version is valid canupdate = trueelse// no minor update, so check that at least minor version is the same before checking for bug fix versionif minor = app.minorversion then// check for bug fix version is validif bug > app.bugversion then canupdate = trueendifendifendifendif

This is not necessary, but useful if you are developing: for example if your development version is 3.1.0 and the version on the web server is 3.0.6, then the old code would indicate that 3.0.6 is newer than 3.1.0.

I did not disable the Cancel button when a download was started and changed the Action method to the following:

UpdateSocket.Close

Close

This terminates the download and closes the socket first to prevent an exception.

First, I use the "file" folder item as it is safer. Secondly, I check for HttpStatus = 200, which means download successful. A wrong filename for example will complete the download with HTTPStatus = 404 and an empty targetfile.