Set str1 = sh.BrowseForFolder(Me.hwnd, "Select a Folder", BIF_NEWDIALOGSTYLE, ssfDRIVES)
If Not str1 Is Nothing Then MsgBox str1.Self.Path
End Sub
Pradeep
Pradeep, Microsoft MVP (Visual Basic) Please appreciate posts that have helped you by clicking icon on the left of the post.
"A problem well stated is a problem half solved." — Charles F. Kettering
I looked at thevbAccelerator version and works like a charm, so will contiue with that one for now.
Cheers people
It will work with Win2000 and above havig IE6 and above only.
Pradeep
Pradeep, Microsoft MVP (Visual Basic) Please appreciate posts that have helped you by clicking icon on the left of the post.
"A problem well stated is a problem half solved." — Charles F. Kettering
What method are you using to Browse for folders?
Pradeep's suggestion of adding the BIF_NEWDIALOGSTYLE flag works for me. Here is a full implementation
VB Code:
Option Explicit
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 Type BROWSEINFO
hWndOwner As Long
pIDLRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Private Const BIF_RETURNONLYFSDIRS = 1
Private Const BIF_DONTGOBELOWDOMAIN = 2
Private Const BIF_NEWDIALOGSTYLE = &H40
Private Const MAX_PATH = 260
Public Function BrowseForFolder(OwnerForm As Form) As String
good work moeur. but right now i am not able to give you rep. So a :thumbs: up for now .
i have a question. does ur code will also display the Add Folder button. because it is not showing on my PC. nor does the code provided by Pradeep because i m not using 2000 or Xp nor i have ie6.
Use the Dependency Walker that come with VS to find all about the dll including its version
1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
2) If someone has been useful to you please show your respect by rating their posts.
3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
4) Before posting your question, make sure you checked this links: MICROSOFT MSDN -- VB FORUMS SEARCH
5)Support Classic VB - A PETITION TO MICROSOFT
thnx Wiz, it seems that it is below ver 5. so does installing SP update it automatically?
also, how can i add shell32.dll as a reference. i am not able to do it by browsing and dont seem to get the reference name.
To add the reference to shell32.dll, add a reference to "Microsoft Shell Controls and Automation" to your project.
Pradeep
Pradeep, Microsoft MVP (Visual Basic) Please appreciate posts that have helped you by clicking icon on the left of the post.
"A problem well stated is a problem half solved." — Charles F. Kettering
The two BIF flags - BIF_NEWDIALOGSTYLE and BIF_USENEWUI are only available if you have 5.0 or above. If you dont have 5.0 then the "New Folder" button is not supported at all.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
The two BIF flags - BIF_NEWDIALOGSTYLE and BIF_USENEWUI are only available if you have 5.0 or above. If you dont have 5.0 then the "New Folder" button is not supported at all.
which one, shell32.dll or ShDoc401.dll. please see post 19 and 20. while Pradeep says adding reference to Microsoft Shell Controls and Automation will add Shell32.dll but it is referencing to ShDoc401.dll on my PC.
though the version of Shell32 is below but shDoc is of ver 5.
Note 3: Version 5.80 of Comctl32.dll and version 5.0 of Shlwapi.dll are distributed with Internet Explorer 5. They will be found on all systems on which Internet Explorer 5 is installed, except Windows 2000. Internet Explorer 5 does not update the Shell, so version 5.0 of Shell32.dll will not be found on Windows NT, Windows 95, or Windows 98 systems. Version 5.0 of Shell32.dll will be distributed with Windows 2000 and Windows Me, along with version 5.0 of Shlwapi.dll, and version 5.81 of Comctl32.dll.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
You can upgrade to IE 6 SP1 and VS SP6 as it states that its available in IE 5 but not on the bundled instance that is distributed with Win 2000 or ME. You need to get Version 5.80 of Comctl32.dll and version 5.0 of Shlwapi.dll. So if they are included with installing IE 6 SP1 and VS SP6 then that should do it.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.