0

I'm creating an installer at work that must open a file browser. There is no file browser in wix, so I built a custom vbscript action that uses the Shell.BrowseForFolder method. It's working fine, but the file dialog shows up behind the main wix window. Does anyone know a wix/vbscript approach I could take to solve this problem?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
user2437443
  • 2,067
  • 4
  • 23
  • 38

1 Answers1

1

Locate the HWND for the MSI UI and pass this into Shell.BrowseForFolder. I see a few example solutions that use FindWindow("MsiDialogCloseClass", vbNullString). Be careful about launching UI from a custom action: you need to consider silent installs/repair/uninstall, etc to make sure you get it right in all cases.

It looks like you're trying to allow the user to pick a directory. MSI has native support for this. I reccomend you use that. For an example see http://wix.codeplex.com/SourceControl/latest#src/ext/UIExtension/wixlib/BrowseDlg.wxs.

TheESJ
  • 2,357
  • 17
  • 13
  • Thanks for the quick response! I'm trying to allow the user to select a specific file, not just the directory, so I think I need the custom action. I'm pretty new to wix and everything to do with msi, could you tell me how I would locate the HWND, and how to pass it into the vbScript function? – user2437443 Dec 16 '13 at 21:54
  • MSI doesn't expose the HWND, so you need to find it on your own. Lack of knowledge of MSI here shouldn't hold you back. Use FindWindow to locate the window by name, as I mentioned. Alternatively you could enumerate the windows on the system to find one that matched a criteria you expect (title, process ID, etc). You may find that VBScript really restricts your ability to do much here given the limited surface area available. – TheESJ Dec 17 '13 at 04:51