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

How to Get MsiWindowHandle


3 replies to this topic

SeanH

SeanH
  • Members
  • 21 posts

Posted 02 June 2005 - 17:10

Is there a way to get a handle to the Msi's window from a custom action? Afaik, a standard MSI custom action is only passed a handle to the installer.

In installshield, you can make a custom action that gets passed multiple paramaters (i'm talking dll here), and one of the constants you can pass is the MsiWindow handle.

But in normal, non installshield land, is there a way to get this window handle? I ask, because you need it to make sure any MessageBox's you pop up appear with the correct z-order (in other words, above the msi window).

_nick_

_nick_
  • Members
  • 34 posts

Posted 03 June 2005 - 13:10

All MSI sends to a custom action is the MSIHANDLE, Installshield must have a go between function that finds the correct window for you and passes you that handle. I would do a find window with your caption and the window class.

SeanH

SeanH
  • Members
  • 21 posts

Posted 03 June 2005 - 17:26

i figured there would be a way to do it such as that, but I was hoping their was a more legit method, such as the MSI exposing a WindowHandle property, or similiar. I mean, in a custom action, popping up a message box has to be pretty common, and you need that handle to get your z-order right.

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 04 June 2005 - 09:05

If you need an owner for (eg.) a FileOpen dialog, and you are running in an UI sequence, just ask the active window of the current thread. But in the execute sequence, it won't be that easy: Windows doesn't like it when two processes start peeking each other (think of installing with elevated priviliges).

When you only want to show a message, you should use MsiProcessMessage, which takes care of this. However, it does NOT show the message when 1) your CA is called by a ControlEvent instead of a sequence; and 2) when the install is silent.