Hi
I have an application installed.
I need to have a functionality that prevents user from uninstalling the application if application is currently running. I uninstall appliation from Add/Remove programs.

I have functionality in my system that allows it to be minimized to the task bar and to system tray. During minimized to system tray user can access system tray menu and click "Show" menu to see the application windows again. During minimized state in system tray all the application windows are hidden.

If application is minimized to task bar and i try to uninstall the application, windows wont allow me to uninstall it and show me some message like "Following appliation should be closed before continuing install". This is a good behaviour. This is what i want. But same message don't appear if system is minimized to system tray. During system tray minimized state no application window is visible to the user. And programming is running. Still window usninstalls my application.

How can i prevent user from uninstalling the application if application is minimized to system tray.

Please help
Thanks

Recommended Answers

All 4 Replies

How are you detecting if the application is running? That would seemingly be the problem here. Create a mutex when your application fires up then add a custom action in your deployment project for uninstallation that checks for the existence of the mutex then bails out.

I am using Setup and deployment project. I also have a custom class derived from Installer class. I can check if process is running in "BeforeUninstall" event. if i find process running i can show custom message that "Please exit all the applications before peforming uninstall". But how do i exit the installer if user "cancels" the installation by pressing the button that i show in message box.

That depends on what type of deployment project you're using. Is it a WiX project or a standard deployment project? Also you may not be able to see processes running by other users unless you're an administrator so that approach may not be the best.

What shall i do to fix this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.