|
-
December 15th, 1999, 11:09 AM
#1
folder browser dialog, like setup programs
When during a setup you click the browse button to select folder to install to, appear a dialog with only folders like a treeview.
How can I call that dialog box?
thanks
Something over there is coding....
... and you don't know!
-
December 15th, 1999, 04:02 PM
#2
Re: folder browser dialog, like setup programs
You can use the SHBrowseForFolder API, here's an example I've put together..
In a Module..
option Explicit
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
private Declare Sub CoTaskMemFree Lib "ole32.dll" (byval hMem as Long)
private Declare Function lStrCat Lib "kernel32" Alias "lstrcatA" (byval lpString1 as string, byval lpString2 as string) as Long
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 Const BIF_RETURNONLYFSDIRS = 1
public Function BrowseForFolder(byval lHwnd as Long, byval sPrompt as string) as string
Dim tBI as BROWSEINFO
Dim lList as Long
Dim lResult as Long
Dim sPath as string
With tBI
.hwndOwner = lHwnd
.lpszTitle = lStrCat(sPrompt, Chr(0))
.ulFlags = BIF_RETURNONLYFSDIRS
End With
lList = SHBrowseForFolder(tBI)
If lList then
sPath = Space(260)
lResult = SHGetPathFromIDList(lList, sPath)
Call CoTaskMemFree(lList)
sPath = Left$(sPath, InStr(sPath, Chr(0)) - 1)
End If
BrowseForFolder = sPath
End Function
In your Form..
private Sub Command1_Click()
Caption = BrowseForFolder(hwnd, "Select Directory..")
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|