cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
CChong
Level 11 Flexeran
Level 11 Flexeran

a way of closing the application

I am looking for a way to close the application once the user initiates the process of updating their application. If the wizard comes up it means we have an update if the user starts using that wizard is there a way to close the parent application??? Any ideas?
0 Kudos
(3) Replies
crehbein
Level 3

It depends on what kind of application you have, but exit() works for me in C/C++ land.

The point is, it's up to the developer to figure out what to do if an update's available. If you want to exit your app, call your exit routines. Once the update starts downloading (ie, you call AppUpdate()) the agent takes care of the install. You can quit your app at that point.
0 Kudos
emcknight
Level 3

But how do you know when it's complete? How do you know if it's found a new version? I didn't see any events that I can "hook" into (I'm using VB.NET and COM Interop to access the COM Object) so how can I determine when to actually shut down?
0 Kudos
tboberek
Level 2

emcknight wrote:
But how do you know when it's complete? How do you know if it's found a new version? I didn't see any events that I can "hook" into (I'm using VB.NET and COM Interop to access the COM Object) so how can I determine when to actually shut down?


emcknight --

I'm using C# and COM Interop, so my situation is pretty similar. What I would do in your situation is call EnumUpdates() first to see if there are any updates. Then I use GetProcessByName (under System.Diagnostics.Process) to get all the running instances of my application. Once I have that list of processes, I iterate through the list and close each process with CloseMainWindow().

You probably could attach an event handler to the Agent's OnDownloadBegin event and close the apps there, which would save you the step of using the EnumUpdates. However, that might create a race condition between the closing of the app and the completion of the download. For example, if your app is like ours, it asks the user to save when it's closing and there is unsaved data. If the user doesn't notice this, then the download could very well finish and the update run before you close you app.

Hth,
T.J.
0 Kudos