Type bff
hwndOwner 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
Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (bff As bff) As Long
Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal IDList As Long, ByVal sPath As String) As Long
Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal handle As Long)
Public Function GetFolder(hwnd As Long) As String
Dim bff As bff
Dim retValue As Long
Dim strPath As String
Dim ret As Long
Dim pos As Long
bff.hwndOwner = hwnd
bff.ulFlags = 1
retValue = SHBrowseForFolder(bff)
strPath = Space(512)
ret = SHGetPathFromIDList(retValue, strPath)
If ret Then
pos = InStr(strPath, Chr(0))
GetFolder = Left(strPath, pos - 1)
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载