Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Detecting if add/remove programs used


4 replies to this topic

jonathan2002

jonathan2002
  • Members
  • 44 posts

Posted 18 September 2003 - 15:37

I have an installation which needs to check if the user has any of the Control Panel windows open when starting to uninstall, so it can then stop and warn that the windows must be closed (this prevents a problem arising). I have implemented this checking process with a special .exe that can detect the windows.

The trouble now arises that, if the uninstall is started from the Add/Remove Programs window, that window is then detected and the test failed. So I need a way to check if the uninstall was started that way, so I can then allow 1 (just one) instance of rundll32.exe to be in existence, and halt otherwise.

How can I check if Add/Remove Programs initiated the uninstall?

In NT, this does not run silently, so detecting Silent Mode is not sufficient.

ActiveInstall

ActiveInstall
  • Members
  • 2 posts

Posted 18 September 2003 - 15:48

Jonathan,

Behind the scenes, the control panel is utilizing the MSI API to invoke the uninstall of your product. As a result, there is no way to reliable know how the uninstall was initiated.

Other than the methods you are using now, I have no alternative to offer. Can I ask what the real problem is?
R. Michael Sanford
Windows Installer MVP (but not nearly as valuable as Stefan!)
http://www.activeinstall.com

jonathan2002

jonathan2002
  • Members
  • 44 posts

Posted 19 September 2003 - 09:09

The issue was originally that trouble arose if the Services window was open when the product was uninstalled. So the solution is to check if any such window is open, then halt to complain to the user. I already use a custom exe to detect if certain other processes are running, so I check for rundll32.exe on NT, or mmc.exe on XP.

The trouble is that on NT this will also detect the Add/Remove window.

I am now going to look at my detection program again, to see if it can determine exactly which CP window is open, so then I can limit the test to just the Services window.

dcleous

dcleous
  • Members
  • 38 posts

Posted 20 September 2003 - 18:29

it's actually addwiz.cpl that opens the "add/Remove Programs" window....

If you can look for the process...or GetwindowHandle for this "add/Remove Programs" window and do EnumerateWindows and a FindWindow

but that;s a boring process...
if you can explain the problem ..may be I understood it wrong...we can look for a more apt solution.

jonathan2002

jonathan2002
  • Members
  • 44 posts

Posted 22 September 2003 - 09:46

The problem is that I need to detect the Services window of the Control Panel, on NT & 2000. The removal should not proceed if it is open, as it causes trouble.

I already have a small program that can check if any specified .exe is running. With this I can check if mmc.exe is running on XP, which provides the window there.

However, on NT&2000 the exe is rundll32.exe, which laso provides the Add/REmove window and various others, and thus my test is not adequate.

What I need is either:

1. a more specific test for the Services window on NT&2000, that does not detect other Control Panel windows, or
2. a specific test for the Add/Remove window, so I can cross-check if it is running on NT/2k. I don;t want to fail the test if only Add/Remove is open but not Services.