Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am creating a setup(installer) file with Visual studio installer project. I created a custom installer class that extends a System.Configuration.Install.Installer class. I overided the Install method, and basically what I do is start an external exe. This exe file is a custom application created for the purpose of coniguring the application that was installed(configuring firewall, selecting databases used by application...). This "Custom action" aplication has a Cancel button enabling the user to cancel the install. When the user clicks it my installer class is notified through the exit code of the Custom Action application. The problem is how to tell the installer to rollback the installation. If I throw an InstallException an error window is shown telling the user there was a problem with the installer and it does not seem like a good solution. I found a partial solution to my problem on http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/ea7d09d1-2812-4f04-b6ed-e7293f2a2d75/[^] (Bottom of the page). It suggests to use a PInvoke SendMessage to programmaticaly "click" the cancel button on the installer window. This works fine but the problem is that after "clicking" the cancel button you get a confirmation popup asking you if you are sure you want to cancel an installation. I tried the same approach(SendMessage) to "click" yes on the popup but for some reason it doesn't work. It tried using the spy++ to discover the correct values for SendMessage and FindWindowEx function, but with no success. Any idea will be appreciated.

Uroš
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900