How to start the updated version of the running application.

H

Harsha

Hi,

I have executables of an application and the application is running on the
device(Compact framework).
This application downloads executables of updated version of the same
application from server.
I have to close the application which is runnig and have to start the upated
version of exe which is downloaded from the server.

Please let me know how to do this. I tried Process.start() without success.
If I am not clear please revert back to me for more details.

Regards,

Harsha.
 
D

DrewCE

In the full version of the .Net Framework we have Application.Restart() to
help us in cases like this. But, I'm not aware of such a beast in the
Compact Framework.

In the past, I've solved this problem using a help process (I called it
Updater). When an application wanted to updated itself, it would start
Updater with some command line arguments, and would exit. Updater would
then wait the the calling process to exit (see Process.WaitForExit() -
http://msdn2.microsoft.com/en-us/library/fb4aw7b8.aspx), process the update,
and then restart the application using Process.Start().

I quick google yielded another possibility...
http://www.themssforum.com/Compact/application-restart/

-Drew
 
D

DrewCE

My apologies, apparently I was a little too eager to press the 'send'
button. Here is the same post sans embarassing typos....

In the full version of the .Net Framework we have Application.Restart() to
help us in cases like this. But, I'm not aware of such a beast in the
Compact Framework. In the past, I've solved this problem using a helper
process (I called it Updater). When an application wanted to update itself,
it would start Updater with some command line arguments, and would then
exit. Updater would then wait for the calling process to exit (see
Process.WaitForExit() -
http://msdn2.microsoft.com/en-us/library/fb4aw7b8.aspx), process the update,
and then restart he application using Process.Start().

I quick google yielded another possibility...
http://www.themssforum.com/Compact/application-restart/

-Drew
 
D

dbgrick

If you are using a cab for the update, you can write a setup dll that closes
your existing app, waits for shut down and then performs the upgrade. If you
are using a custom exe to do this, then you can do the same in your customer
update exe file. You can use the native FindWindow method to find your old
app handle and then either send a message to the app to shut down, or if not
concerned about a nice shutdown, kill the process.

Regards,
Rick D.
 
D

DrewCE

Rick, good point with using setup.dll. However, just remember that doing so
will make the .CAB file processor dependent. The setup.dll is native and
must be compiled for the processor you are working with. If you are only
deploying to ARM targets, which is likely, then you will be fine. Otherwise
you need to have separate .CAB files for each target processor (x86, ARM,
etc.) which can make release management a bit of a pain.

-Drew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top