Brad,
Yes you do need to use BIF_NEWDIALOGSTYLE and yes you do need to set a
flag for this.
Please see the code below which will give you the result
Option Compare Database
Private Const BIF_RETURNONLYFSDIRS = 1 ' For finding a folder to
start document searching
Private Const BIF_DONTGOBELOWDOMAIN = 2 ' For starting the Find
Computer
Private Const BIF_STATUSTEXT = 4 ' Top of the dialog has 2
lines of text for BROWSEINFO.lpszTitle and one line if
' this flag is set.
Passing the message BFFM_SETSTATUSTEXTA to the hwnd can set the
' rest of the text. This
is not used with BIF_USENEWUI and BROWSEINFO.lpszTitle gets
' all three lines of
text.
Private Const BIF_RETURNFSANCESTORS = 8
Private Const BIF_EDITBOX = 16 ' Add an editbox to the
dialog
Private Const BIF_VALIDATE = 32 ' insist on valid result
(or CANCEL)'
Private Const BIF_NEWDIALOGSTYLE = 64 ' Use the new dialog
layout with the ability to resize
' Caller needs to call
OleInitialize() before using this API
Private Const BIF_BROWSEINCLUDEURLS = 128 ' Allow URLs to be
displayed or entered. (Requires BIF_USENEWUI)
Private Const BIF_UAHINT = 256 ' Add a UA hint to the
dialog, in place of the edit box. May not be combined with BIF_EDITBOX
Private Const BIF_NONEWFOLDERBUTTON = 512 ' Do not add the "New
Folder" button to the dialog. Only applicable with
BIF_NEWDIALOGSTYLE.
Private Const BIF_NOTRANSLATETARGETS = 1024 ' don't traverse target
as shortcut
Private Const BIF_BROWSEFORCOMPUTER = 4096 ' Browsing for Computers.
Private Const BIF_BROWSEFORPRINTER = 8196 ' Browsing for Printers
Private Const BIF_BROWSEINCLUDEFILES = 16384 ' Browsing for Everything
Private Const BIF_SHAREABLE = 32768 ' sharable resources
displayed (remote shares, requires BIF_USENEWUI)
Private Const MAX_PATH = 260
Private Declare Function SHBrowseForFolder Lib "shell32" _
(lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" _
(ByVal pidList As Long, _
ByVal lpBuffer As String) As
Long
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
(ByVal lpString1 As String,
ByVal _
lpString2 As String) As Long
Private Type BrowseInfo
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Public Function Folderlocate() As String
' Opens a Treeview control that displays the directories in a computer
' Allows the user to either select an excisting location or create a
new folder
Dim lpIDList As Long
Dim sBuffer As String
Dim szTitle As String
Dim tBrowseInfo As BrowseInfo
szTitle = "Please Select the BAckup Location:"
With tBrowseInfo
.hWndOwner = hwnd
.lpszTitle = lstrcat(szTitle, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN +
BIF_NEWDIALOGSTYLE
End With
lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
sBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, sBuffer
sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
Folderlocate = sBuffer
End If
End Function
The code aobve contains the values for all flags associated to
SHBrowseForFolder.
As you can see the flag value for BIF_NEWDIALOGSTYLE is 64.
If you are using VB or VBA you do not need to use CoInitializeEx
Hope this helps.
Thanks
Simon