Re: Need to run an application from within main but close the main

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Ok. Thanks.
--
Noble D. Bell
www.noblesoftware.com



"Chris Tacke, eMVP" wrote:

And all of that ios possible - you just have to know how to shut down your
app. THe original code you posted did not guarantee that - it made the
faulty assumption that APp.Exit would close the app. You need to make sure
all threads exit.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


"Noble Bell" <NobleBell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AB3E69EA-C080-47D6-8082-2B2AA1DC5493@xxxxxxxxxxxxxxxx
Hi Chris,

Thanks for your comment. Here is what has to happen:

1) The main app is running
2) At a given event (button click or timer tick) the app looks to see if
there is a new version of itself.
3) If there is a new version of itself (exe and/or db) it needs to start a
seperate updater.exe program and shut itself down completely.

The main app has to shut down completely because in the updater
application
it does the following:

1) Makes a backup of the exitsing app (exe and db)
2) Downloads the new version of the main app and then copies the new
version
of the exe over the top of the existing version
3) Run update scripts against the database.

When the updater has completed the process needs to shut down the updater
app and close it completely and then restart the main application.


--
Noble D. Bell
www.noblesoftware.com



"Chris Tacke, eMVP" wrote:

Sure, this app will run as long as the thread you started runs, and we
have
no idea what it's doing. Application.Exit does *not* exit an app - it's
a
misnomer. It simply exits the current message pump, which will exit a
previous call to Application.Run.

What you should be doing is just launching the remote process and then
exiting.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


"Noble Bell" <NobleBell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D558F3F0-C024-4324-9140-F44344DF2A2E@xxxxxxxxxxxxxxxx
I want to start a different exe file from within my main application and
then
close the main application. I can start the other application but it
does
not
seem to be closing the main application. Below is the code that I am
using:


Syncing.ApplicationUpdater appUpdater = new
Syncing.ApplicationUpdater();
if (!System.Diagnostics.Debugger.IsAttached)
{
System.Threading.ThreadStart myThreadDelegate =
new
System.Threading.ThreadStart(appUpdater.StartUpgradeStub);
System.Threading.Thread myThread = new
System.Threading.Thread(myThreadDelegate);
Application.Exit();
myThread.Start();
}

public partial class ApplicationUpdater
{
public void StartUpgradeStub()
{
System.Diagnostics.Process cur = new
System.Diagnostics.Process();
cur.StartInfo.UseShellExecute = true;
cur.StartInfo.FileName = @"\Program
Files\autoupdater\AutoUpdater.exe";
cur.Start();
}
}


--
Noble D. Bell
www.noblesoftware.com







.



Relevant Pages

  • Re: Default .Net Application as Subproject
    ... That makes a large assumption that the app is os project specific. ... Chris Tacke, Embedded MVP ... add the debugger client files to your OS image or deploy them to the ... Hall's CE File Wizard. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: How do I get ActiveSync to automatically start my desktop app?
    ... Rename the device app ... >> Chris Tacke ... >>> After the link between the desktop and the Pocket PC (PPC) is ...
    (microsoft.public.pocketpc.developer)
  • Re: Create user account for ftpd
    ... "Chris Tacke, eMVP" wrote: ... So if I call from a managed app at runtime - can someone tell me what DLL ... I 'could' do it in my target ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Leaving threads open??
    ... How does the thread procedure exit? ... your app closes, and this is what's preventing you from restarting. ... >> Chris Tacke ... >> Are you using the SDF? ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Longtime running requirement in control system
    ... We will use Webserver do configration works, ... idea what you BSP or app look like, or your development skills with either. ... Chris Tacke, Embedded MVP ...
    (microsoft.public.dotnet.framework.compactframework)