bsp; .lpszTitle = Caption & Chr$(0)
Else
.lpszTitle = "Select a Folder" & Chr$(0)
End If
End With
pidl = SHBrowseForFolder(bi)
If SHGetPathFromIDList(ByVal pidl, ByVal ret) Then
Folder = Left$(ret, InStr(ret, Chr$(0)) - 1)
Else
Folder = ""
End If
End Sub
在
程序中使用类的代码:
Private Sub cmdBrowse_Click()
Dim c As clsGetPath ''声明对象变量
Set c = New clsGetPath
With c
.Caption = "请选择一个文件夹"
.Flags = 0
.hwnd = Me.hwnd
End With
c.GetFolder
txtPath.Text = c.Folder
End Sub