Option
Explicit
'Powered by barenx

Private
Declare
Function SHBrowseForFolder()
Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long


Private Declare Function SHGetSpecialFolderLocation()Function SHGetSpecialFolderLocation Lib _
"shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder _
As Long, pIdl As ITEMIDLIST) As Long


Private Declare Function SHGetFileInfo()Function SHGetFileInfo Lib "Shell32" Alias _
"SHGetFileInfoA" (ByVal pszPath As Any, ByVal _
dwFileAttributes As Long, psfi As SHFILEINFO, ByVal _
cbFileInfo As Long, ByVal UFlags As Long) As Long


Private
Declare
Function SHBrowseForFolder()
Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long

Private Declare Function SHGetSpecialFolderLocation()Function SHGetSpecialFolderLocation Lib _
"shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder _
As Long, pIdl As ITEMIDLIST) As Long

Private Declare Function SHGetFileInfo()Function SHGetFileInfo Lib "Shell32" Alias _
"SHGetFileInfoA" (ByVal pszPath As Any, ByVal _
dwFileAttributes As Long, psfi As SHFILEINFO, ByVal _
cbFileInfo As Long, ByVal UFlags As Long) As Long

这篇博客介绍了如何在VB中使用系统API调用来实现选择文件夹的功能。通过声明和使用SHBrowseForFolder、SHGetSpecialFolderLocation等函数,可以创建一个浏览对话框,让用户选择文件夹,并获取所选路径。
最低0.47元/天 解锁文章
1178

被折叠的 条评论
为什么被折叠?



