cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Matronix
Level 6

Dialog box not popping up in the foreground on Windows 2008

I am using a Basic MSI and calling a managed code custom action. The C# dll for my custom action contains a windows form that will pop up as a dialog during the UNINSTALL process of my product. The issue I am having is that the dialog always pops up behind the IS dialogs for uninstalling. I have seen this work on an XP machine but fails to put my dialog in the Foreground on a Windows 2008 machine. (I have tried to put in SetForeground code in my managed code but nothing seems to work.)

Any help or suggestions out there? I am completely stuck on this.
Labels (1)
0 Kudos
(1) Reply
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

The only reliable method of ensuring your window appears on top of an MSI window is to use the MSI window's handle as your window's parent. However, MSI does not provide a handle in any form to any of its UI dialogs. Unfortunately, the dialog used during uninstall (or any install launched with /qb) is a generic dialog window class, which makes it much more difficult to use something like FindWindow to obtain a handle to the MSI dialog window (attempting to find a generic dialog can result in obtaining a window handle to a completely unrelated process).

Please note that any time a basic UI or no UI is running, only the install execute sequence in the MSI is being run by Windows Installer. Any custom actions that display any type of user interface should, by definition, only display their UI when the UILevel is 4 or higher (please see http://msdn.microsoft.com/en-us/library/aa368281(VS.85).aspx). Alternately, the MsiProcessMessage API can be used to display message box type dialogs, which will properly handle displaying or not displaying a message box based on UI level automatically.
0 Kudos