This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Window Handle in Managed Custom Action
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 27, 2008
09:28 AM
Window Handle in Managed Custom Action
Has anybody been able to figure out a way of getting the window handle to the installer? I want to move away from my InstallScript which currently passes this parameter to my .Net custom action.
In InstallScript this always (even in deferred mode) return the proper value:
hWindowHandle = GetWindowHandle( HWND_INSTALL );
In .Net, I am trying to call msi.dll apis or go from Process.GetCurrentProcess() and find my way back to a visible window but no luck. I was suggested to use FindWindow or EnumThreadWindows, I can't use FindWindow because it needs the window title and I may not have access to that, EnumThreadWindows for some reason can't seem to find my window...
InstallShield were not allowed to disclose the inner workings of GetWindowHandle so I don't have much to go on. I know that HWND_INSTALL is a constant equal to -2. Perhaps this is a parameter sent to a Windows api???
Any leads are highly appreciated.
Thanks
Nic
In InstallScript this always (even in deferred mode) return the proper value:
hWindowHandle = GetWindowHandle( HWND_INSTALL );
In .Net, I am trying to call msi.dll apis or go from Process.GetCurrentProcess() and find my way back to a visible window but no luck. I was suggested to use FindWindow or EnumThreadWindows, I can't use FindWindow because it needs the window title and I may not have access to that, EnumThreadWindows for some reason can't seem to find my window...
InstallShield were not allowed to disclose the inner workings of GetWindowHandle so I don't have much to go on. I know that HWND_INSTALL is a constant equal to -2. Perhaps this is a parameter sent to a Windows api???
Any leads are highly appreciated.
Thanks
Nic
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 27, 2008
10:44 AM
Did some more digging and found out that msiexec does sandboxing for certain things. My dll runs in a different sandbox than where the UI resides. So if I get the current process through Process.GetCurrentProcess() this pid is not representing the process which holds the windows so that explains why EnumThreadWindows does not work.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 27, 2008
11:06 AM
Could you clarify why you are looking for the handle to the UI in a Managed Custom Action?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 27, 2008
12:16 PM
I need the handle for two reasons.
1. Our installer currently already uses this method of showing messages/dialogs and it would be a big change in the code if we were to try to do this as a pure msi dialog. Actually I don't even think it would be possible.
2. This handle will allow me to display messages and other boxes that will be modal to the install wizard. I don't want them to be able to play with the wizard unless they have dismissed my dialog.
1. Our installer currently already uses this method of showing messages/dialogs and it would be a big change in the code if we were to try to do this as a pure msi dialog. Actually I don't even think it would be possible.
2. This handle will allow me to display messages and other boxes that will be modal to the install wizard. I don't want them to be able to play with the wizard unless they have dismissed my dialog.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)