Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Closing a program upon Uninstall
 

Closing a program upon Uninstall

I want to have it so that when the user uninstalls my program, the program, if it's running, is closed.

I already have a custom uninstaller override and the original program has a mutex handle to avoid it opening twice. I can tell via the mutex if the program is open, but don't know what to do to close the program. Any pointers? Thanks.

Jared M S  Monday, October 01, 2007 10:19 PM

You can use Process.GetProcessesByName to find your process. Then use Close to close the application. You might need to handle the case where it doesn't want to close. In that case you might have to resort to Kill instead.

Michael Taylor - 10/2/07

http://p3net.mvps.org

TaylorMichaelL  Tuesday, October 02, 2007 2:00 PM

You can use Process.GetProcessesByName to find your process. Then use Close to close the application. You might need to handle the case where it doesn't want to close. In that case you might have to resort to Kill instead.

Michael Taylor - 10/2/07

http://p3net.mvps.org

TaylorMichaelL  Tuesday, October 02, 2007 2:00 PM

You can use google to search for other answers

Custom Search

More Threads

• No Publish Options Available??
• ClickOnce installed app will not run
• Including Driver with Application Setup...
• Deployment Issues (Major Headache)
• help with deployment - mshtml.dll
• Problems after the setup has finished
• RemovePreviousVersions: Installs before it uninstalls??
• Can't create text file output from C# Windows Forms app when deployed with Windows Installer
• Do not want product to appear in add/remove program
• Start Menu Shortcut