vb文件目录浏览器

来源:百度知道 编辑:UC知道 时间:2024/06/27 11:12:42
样式和千千静听的添加歌曲目录的样式一样的。就是是windows样式的,vb自带的不能显示图标。还有就是包含子目录的选项。希望高手指教。可以添加文件或文件夹。

'一个按钮
Private Type BrowseInfo
lngHwnd 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 Const BIF_RETURNONLYFSDIRS = 1
Private Const MAX_PATH = 260

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 Function BrowseForFolder(ByVal lngHwnd As Long, ByVal strPrompt As String) As String

On Error GoTo ehBrowseForFolder