|
谢谢版主,但我想要的是获得对话框中所选取的文件名变量,
能不能用API函数呢?我对API不熟悉,只找到获取路径的Declare声明,即
Private Declare Function SHGetPathFromIDList Lib "Shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As LongPrivate Declare Function SHBrowseForFolder Lib "Shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As LongPrivate Type BROWSEINFO ...
Private Sub mulukuang()Dim bi As BROWSEINFO '声明必要的变量
Dim rtn&, pidl&, path$, pos%
'bi.hOwner = Me.Hwnd '使对话框处于屏幕中心
bi.lpszTitle = "选择目录..." '设置标题文字
bi.ulFlags = BIF_RETURNONLYFSDIRS '返回文件夹的类型
pidl& = SHBrowseForFolder(bi) '显示对话框
path = Space(512) '设置字符数的最大值
T = SHGetPathFromIDList(ByVal pidl&, ByVal path) '获得所选的路径
pos% = InStr(path$, Chr$(0)) '从字符串中提取路径
SpecIn = Left(path$, pos - 1)
If Right$(SpecIn, 1) = "" Then
specout = SpecIn
Else
specout = SpecIn + ""
End IfEnd Sub
那获取文件名的函数是什么呢?请帮忙列出一下,谢谢! |
|