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.

How to make VBScript BrowseForFolder window modal

2 replies to this topic


  • Members
  • 11 posts

Posted 17 December 2004 - 21:25

I have a VBScript custom action that uses BrowseForFolder. It works great, but SOMETIMES - not all the time - the BrowseForFolder dialog comes up behind the InstallShield dialog.

Does anyone know of a method to ensure that a VBScript dialog (specifically the BrowseForFolder dialog) appears as the front-most Window?

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Unable to locate Security Database.", &H10 + &H200, 18)
Set objFolder = objFolder.Self
objFolderPath = objFolder.Path


  • Members
  • 32 posts

Posted 21 December 2004 - 17:38

You could use the Shell.MinimizeAll() method before the call to BrowseForFolder ..... this would minimize all other windows and then only your Browse DialogBox would be visible....

Its a bit funny way of doing it but would suffice yr requirements...




  • Members
  • 16 posts

Posted 28 January 2005 - 10:07

This is a somewhat convoluted approach, but it is one I have applied sucessfully in the past:

Create a wrapper DLL that contains the code to display the Shell Browser instead of calling the SHBrowse API directly.

Add an invisible form to the DLL that is displayed modally.

Invoke the wrapper DLL from your VBScript and have it's modal form display the shell browser as a child window.

Then you can retrieve the results from properties you've added to the wrapper DLL.

Invoking the shell browser indirectly from a parent modal form implicitly forces the ShellBrowser to behave in a modal fashion.