How to automatic check & update on application startup time?

Hi~

How to do this?when application startup time, check update version. and if new version is added to server.download and update automatically?

If you're making a .NET application you can use the AutomaticUpdater control. For any other language, you can use wyUpdate for silent checking.

Tell me if this helps.

Do you have any C# Example about silent update?

Something like this will work:

string appDir = Path.GetDirectoryName(Application.ExecutablePath);using (Process proc = new Process                   {                       StartInfo =                           new ProcessStartInfo(appDir + "\\wyUpdate.exe", "-quickcheck -justcheck -noerr")                   }){    proc.Start();    proc.WaitForExit();    int exitCode = proc.ExitCode;    if (exitCode == 2 && MessageBox.Show("Update now?", "Update?", MessageBoxButtons.YesNo) == DialogResult.Yes)    {        Process.Start(appDir + "\\wyUpdate.exe");        CloseApp();    }}

Tell me if this helps.

Is it possible to check updates and if it's available close application to launch wyupdate without proccess kill window?

You mean without the message box? Sure, just remove the MessageBox code from the if() statement:

string appDir = Path.GetDirectoryName(Application.ExecutablePath);using (Process proc = new Process                   {                       StartInfo =                           new ProcessStartInfo(appDir + "\\wyUpdate.exe", "-quickcheck -justcheck -noerr")                   }){    proc.Start();    proc.WaitForExit();    int exitCode = proc.ExitCode;    if (exitCode == 2)    {        Process.Start(appDir + "\\wyUpdate.exe");        CloseApp();    }}

Thanks Sam! But i mean that after Application.Exit() or Environment.Exit() app process still stay in process-list and when wyUpdate starts i have window wich asked me to terminate processes and in listbox i see app proccess.

The "Close processes" window will disappear when the program closes. But, no, if your app is slow to shutdown then the "close processes" window will be visible. The only other alternative would be for wyUpdate to start installing, but this would fail because your app is still open.

Maybe i can handle app closed and start wyUpdate process after this event or set a time period after that update process starts? Many thanks for your help.

Well, you can use the ApplicationExit event:

Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
private void OnApplicationExit(object sender, EventArgs e){    // TODO: launch wyUpdate to update}