try something likePublic Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
'BROWSEINFO.ulFlags values:
Public Const BIF_RETURNONLYFSDIRS = &H1
Public Const BIF_DONTGOBELOWDOMAIN = &H2
Public Const BIF_STATUSTEXT = &H4
Public Const BIF_RETURNFSANCESTORS = &H8
Public Const BIF_BROWSEFORCOMPUTER = &H1000
Public Const BIF_BROWSEFORPRINTER = &H2000
Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long'In code...
Dim bInf As BROWSEINFO
Dim RetVal As Long
Dim PathID As Long
Dim RetPath As String
Dim Offset As Integer
'Set the properties of the folder dialog
bInf.hOwner = Me.hWnd
bInf.lpszTitle = "Please select a folder to install to:"
bInf.ulFlags = BIF_RETURNONLYFSDIRS
'Show the Browse For Folder dialog
PathID = SHBrowseForFolder(bInf)
RetPath = Space$(512)
RetVal = SHGetPathFromIDList(ByVal PathID, ByVal RetPath)
If RetVal Then
'Trim off the null chars ending the path
'and display the returned folder
Offset = InStr(RetPath, Chr$(0))
MsgBox "Folder selection was:" & Chr$(10) & Chr$(10) & _
Left$(RetPath, Offset - 1), vbInformation, "SHBrowseForFolder Demo"
Else
MsgBox "User pressed cancel!", vbInformation, _
"SHBrowseForFolder Demo"
End If
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
'BROWSEINFO.ulFlags values:
Public Const BIF_RETURNONLYFSDIRS = &H1
Public Const BIF_DONTGOBELOWDOMAIN = &H2
Public Const BIF_STATUSTEXT = &H4
Public Const BIF_RETURNFSANCESTORS = &H8
Public Const BIF_BROWSEFORCOMPUTER = &H1000
Public Const BIF_BROWSEFORPRINTER = &H2000
Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long'In code...
Dim bInf As BROWSEINFO
Dim RetVal As Long
Dim PathID As Long
Dim RetPath As String
Dim Offset As Integer
'Set the properties of the folder dialog
bInf.hOwner = Me.hWnd
bInf.lpszTitle = "Please select a folder to install to:"
bInf.ulFlags = BIF_RETURNONLYFSDIRS
'Show the Browse For Folder dialog
PathID = SHBrowseForFolder(bInf)
RetPath = Space$(512)
RetVal = SHGetPathFromIDList(ByVal PathID, ByVal RetPath)
If RetVal Then
'Trim off the null chars ending the path
'and display the returned folder
Offset = InStr(RetPath, Chr$(0))
MsgBox "Folder selection was:" & Chr$(10) & Chr$(10) & _
Left$(RetPath, Offset - 1), vbInformation, "SHBrowseForFolder Demo"
Else
MsgBox "User pressed cancel!", vbInformation, _
"SHBrowseForFolder Demo"
End If
解决方案 »
- vb6.0 菜单里面,工程- “引用”项里面的某个DLL的位置如何改啊?
- 如何在模型空间中添加自定义图象,救命ing!!!!(重赏)
- 200分求好的VB电子书
- vb可以做绿色软件吗
- ===============================VB版主:请进来!!=================================
- win98与win2000的打包问题
- 两个问题
- vbs.kj是怎么启动的?
- 100分求voronoi图vb源码
- 在VB上显示了一个网页,可否点选网页上某个信息,让它显示在VB的TEXT1上
- 在VB中如何给窗口分栏的问题,大家帮帮忙!
- 如何在TreeView1_NodeClick事件中判断是鼠标左键还是右键的Click????不是Command1_Click()
A.pszDisplayName = Str(foldername(0))