Hi people, i need the add folder button on the bottom of the browse folder dialog box. The button goes on the bottom next to ok and cancel.
Printable View
Hi people, i need the add folder button on the bottom of the browse folder dialog box. The button goes on the bottom next to ok and cancel.
I would suggest it might be easier to make your own control using a form and the drive listbox.
Do "i suggest" mean that it is impossible to do?, i would rather use the browse folder dialog box if possible
cheers
ILMV
It is probably possible with a lot of subclassing code and such. I don't know for sure. But it would be a lot simpler to create your own.Quote:
Originally Posted by I_Love_My_Vans
However, if you want to use browse folder dialog box then I'll see what I can find for you.
Thank you mate, i have search for it but with little success, and have only jsut had experience of subclassing, but im will to give it a shot.
Thkanks
ILMV
Perhaps you can use this control from VBAccelerator:
http://www.vbaccelerator.com/home/VB...er/article.asp
And perhaps this thread has some answers.
Try This:
VB Code:
Private Const BIF_NEWDIALOGSTYLE = &H40 Private Sub Command1_Click() Dim sh As New Shell32.Shell Dim str1 As Shell32.Folder2 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, didnt work.
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.Quote:
Originally Posted by I_Love_My_Vans
Pradeep
Im on the college computers and loads of things are restricted so that may be the problem.
ILMV.
I will try it at home any way.
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 implementationIf you'd rather use the shell object I can show you how to do that too.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 Dim lpIDList As Long Dim sBuffer As String Dim tBrowseInfo As BROWSEINFO With tBrowseInfo .pszDisplayName = Space$(MAX_PATH) .lpszTitle = "Select a folder" .hWndOwner = OwnerForm.hWnd .ulFlags = BIF_DONTGOBELOWDOMAIN + BIF_RETURNONLYFSDIRS + BIF_NEWDIALOGSTYLE End With lpIDList = SHBrowseForFolder(tBrowseInfo) If (lpIDList) Then sBuffer = Space(MAX_PATH) SHGetPathFromIDList lpIDList, sBuffer BrowseForFolder = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1) End If End Function Private Sub Command1_Click() MsgBox BrowseForFolder(Me) End Sub
I am please to say I was wrong. There isn't that much code involved after all.
Very nice moeur!
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.
Yes, the Add Folder Button does display.
Support for the BIF_NEWDIALOGSTYLE flag requires shell32.dll version 5.0 or later; whatever that means.
so how can i check the dll version?? if its below version 5 then installing SP can update it??
I don't know... Perhaps search msdn?
Use the Dependency Walker that come with VS to find all about the dll including its version
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.Quote:
Originally Posted by Harsh Gupta
Pradeep
yeah i did that, but it is using ShDoc401.dll file and not the Shell32.dll.Quote:
Originally Posted by Pradeep1210
The new style of BFF is dependant upon version 5.0 available depending on your OS or IE version.
Versions:
http://msdn.microsoft.com/library/de...e/versions.asp
BIF_NEWDIALOGSTYLE and BIF_USENEWUI
http://msdn.microsoft.com/library/de...browseinfo.asp
sorry Rob, but couldn't get your point.Quote:
Originally Posted by RobDog888
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.Quote:
Originally Posted by RobDog888
though the version of Shell32 is below but shDoc is of ver 5.
ShDoc401.dll, I believe, is the dll for IE and not Microsoft Shell Controls and Automation. What are you running? OS + IE versions?
ShDoc401.dll is not in the chart on the MS page link I posted.
OS - Win 98 SE
IE - version 5.00.2614.3500
Its explained in Note 3
Quote:
Originally Posted by MS
so can this be fixed by installing any SP on my PC?? if not then how can i show Add folder buuton on the Browse folder Dialog box?
I would go with the suggestion in Post #2. Just create your own control.
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.