显示"浏览文件夹"对话框时没有确定取消按钮,而且不响应,为什么?
编的一个程序需要用到浏览文件夹对话框,有关代码是:
Public 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
Public Const BIF_RETURNONLYFSDIRS = &H1
Public pidl As Long
Public Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Public Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
... ...
Public Function BrowseFolder(owner As Form, root As Long, title As String) As String
Dim bi As BROWSEINFO
Dim r As Long
Dim pidl As Long
Dim path As String
Dim pos As Integer
bi.hOwner = owner.hwnd
bi.pidlRoot = root
bi.lpszTitle = title
bi.ulFlags = BIF_RETURNONLYFSDIRS
pidl = SHBrowseForFolder(bi)
path = Space$(512)
r = SHGetPathFromIDList(ByVal pidl&, ByVal path)
If r Then
pos = InStr(path, Chr$(0))
BrowseFolder = Left(path, pos - 1)
Else
BrowseFolder = ""
End If
End Function
... ...
使用时用类似如下的方式: txtFolder.Text = BrowseFolder(Form1, 0&, "指定将要存放到的文件夹:")
以前是能够正确实现功能的. 但现在不知为什么, 弹出浏览文件夹对话框时就会不响应,且底下也不显示"确定"和"取消"按钮,不知何故.
我刚刚重装了操作系统和VISUAL STUDIO,难道跟这有关?