Workarounds for Common Dialogs in WSH - The Browse For Folder dialog
(Page 3 of 4 )
The last workaround I’d like to share with you is technically not a workaround since it’s not a Common Dialog. However, it is a standard Windows dialog and can be very useful. It’s the Browse For Folder dialog.
Let me preface myself by saying that the Browse For Folder dialog is a bit complex. I’ll provide the basics here to get it working, but the best way to learn it is to try it for yourself.
The Browse For Folder dialog uses a lot of preset values that determine its appearance and functionality. It’s beyond the scope of this article for me to get into each of them. You can find more information here.
You can include only those constants you require or the whole list. In either case, here they are.
'BrowseForFolders hOptions - accepts multiple
Const NO_OPTIONS = &H0000
Const FIND_FOLDER = &H0001
Const FIND_COMPUTER = &H0002
Const SHOW_STATUS = &H0004
Const RETURN_ANCESTORS = &H0008
Const SHOW_EDITBOX = &H0010
Const VALIDATION = &H0020
Const NEW_STYLE = &H0040
Const BROWSE_FOR_COMPUTERS = &H1000
Const BROWSE_FOR_PRINTER = &H2000
Const BROWSE_EVERYTHING = &H4000
'BrowseForFolders intRootFolder
Const DESKTOP = 0
Const PROGRAMS = 2
Const CONTROLS = 3
Const PRINTERS = 4
Const PERSONAL = 5
Const FAVORITES = 6
Const STARTUP = 7
Const RECENT = 8
Const SENDTO = 9
Const BITBUCKET = 10 ' Recycle Bin
Const STARTMENU = 11
Const DESKTOPDIRECTORY = 16 ' (&H10)
Const DRIVES = 17 ' (&H11) MyComputer Drives
Const NETWORK = 18 ' (&H12)
Const NETHOOD = 19 ' (&H13)
Const FONTS = 20 ' (&H14)
Const TEMPLATES = 21 ' (&H15)
Const COMMONSTARTMENU = 22 ' (&H16)
Const COMMONPROGRAMS = 23 ' (&H17)
Const COMMONSTARTUP = 24 ' (&H18)
Const COMMONDESKTOPDIR = 25 ' (&H19)
Const APPDATA = 26 ' (&H1A)
Const PRINTHOOD = 27 ' (&H1B)
Const LOCALAPPDATA = 28 ' (&H1C)
Const ALTSTARTUP = 29 ' (&H1D)
Const COMMONALTSTARTUP = 30 ' (&H1E)
Const COMMONFAVORITES = 31 ' (&H1F)
Const INTERNETCACHE = 32 ' (&H20)
Const COOKIES = 33 ' (&H21)
Const HISTORY = 34 ' (&H22)
Const COMMONAPPDATA = 35 ' (&H23)
Const WINDOWS = 36 ' (&H24)
Const SYSTEM = 37 ' (&H25)
Const PROGRAMFILES = 38 ' (&H26)
Const MYPICTURES = 39 ' (&H27)
Const PROFILE = 40 ' (&H28)
Const SYSTEMx86 = 41 ' (&H29)
Const PROGRAMFILESx86 = 48 ' (&H30)
Next: Using the Browse For Folder dialog >>
More Windows Scripting Articles
More By Nilpo/Developer Shed Staff Writer