Shutdown running applications
Shutdown running applications
Ideally, my installation asks the user to shut down browsers and Acrobat. We are currently doing through a dialog box in a program that InstallAware calls. However, I noticed that some users got really confused because the dialog got lost underneath some other windows. Is there a template for shutting down running applications where everything is integrated into the installer?
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Shutdown running applications
Dear tofutim,
you could use "Terminate Process" command.
This command attempts a safe shutdown of a running application.
It works by calling the ExitProcess API from the context of the running application.
Regards
you could use "Terminate Process" command.
This command attempts a safe shutdown of a running application.
It works by calling the ExitProcess API from the context of the running application.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Shutdown running applications
Hi Francesco, thanks for your prompt reply. Indeed, I started experimenting with Terminate Process - Check for Process seems to work fine, but when I try to Terminate Process, the result is FALSE. (This is "Safely Terminate Process.) I do have a .NET application running, and the installer is Administrator, and the running process is on the user's account. Is this why it doesn't work? Is there a way to force it to work?
Re: Shutdown running applications
Running taskkill does work. However it would be nice to "safely" terminate the program.
Re: Shutdown running applications
Francesco, in my scenario, Safely Terminate Process and Terminate Program always fail, only taskkill kills the program. Again this is a .NET program. Do I need something in my program to handle the messaging?
- Attachments
-
- 2013-05-20_1027.png (11.4 KiB) Viewed 10170 times
Re: Shutdown running applications
It turns out that if I set the Program Window Title Contains: to the exact window title, it does work. I was using a substring. Perhaps you mean "Program Window Title Is: (case sensitive, exact)". Once the program starts terminating, checking if it is running still shows that it is running (because the shutdown takes sometime). Is there an equivalent of Sleep so that I can check on a loop?
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Shutdown running applications
Dear tofutim,
unfortunately, doesn't exist a 100% safe way to forcibly kill an app and it also depends, on which is the current process state of that application.
In fact when this happens (I'm sure you've you have noticed it many times), the caller should inform the user about the termination and then to proceed accordingly.
Please excuse me, but it is not clear to me if the process that you want to kill is running under te same user context.
Anyway, taskkill will brutally terminate the process even if not the case.
Alternatively, but this requires some work on your application, you could send a specific message to the running application in order to handle the request to terminate. I am not a c# expert, but by the following link it seems to be possible in NET as well.
http://www.richardhyland.com/diary/2009 ... plication/
Regards
unfortunately, doesn't exist a 100% safe way to forcibly kill an app and it also depends, on which is the current process state of that application.
In fact when this happens (I'm sure you've you have noticed it many times), the caller should inform the user about the termination and then to proceed accordingly.
Please excuse me, but it is not clear to me if the process that you want to kill is running under te same user context.
Anyway, taskkill will brutally terminate the process even if not the case.
Alternatively, but this requires some work on your application, you could send a specific message to the running application in order to handle the request to terminate. I am not a c# expert, but by the following link it seems to be possible in NET as well.
http://www.richardhyland.com/diary/2009 ... plication/
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Shutdown running applications
... see Sleep API function.
http://msdn.microsoft.com/en-us/library ... s.85).aspx
It can be easily called via "call DLL" command.
Regards
http://msdn.microsoft.com/en-us/library ... s.85).aspx
It can be easily called via "call DLL" command.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Shutdown running applications
Yup that worked perfectly.
Finally, I need a dialog that says... stuff is running, I'm going to shut it down.
Finally, I need a dialog that says... stuff is running, I'm going to shut it down.
Re: Shutdown running applications
It seems that Terminate Program requires an exact Title - I have to close Adobe Reader, but the title of the document precedes Adobe Reader in the title so that "Terminate Program Adobe Reader" does not work. Any workarounds?

