有驱动器、目录、文件列表框三合一吗?

harp 2001-11-06 12:38:56
VB中提供的驱动器、目录、文件列表框很土气,有没有实现类似资源管理器一样的三合一的办法呢?是用TREEVIEW吗?请给个方法。。
...全文
123 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
harp 2001-11-06
  • 打赏
  • 举报
回复
SORRY,SORRY,这回送到了。。:)
foolishtiger 2001-11-06
  • 打赏
  • 举报
回复
现在是16:15:00,我等了一个小时了,你把分送到哪了?还在路上??呵呵
harp 2001-11-06
  • 打赏
  • 举报
回复
foolishtiger兄,谢谢,堪称完美!送分,送分!
cqq_chen 2001-11-06
  • 打赏
  • 举报
回复
挺好!不好意思,我自己没有注意看代码。
foolishtiger 2001-11-06
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
MsgBox GetPath(Me.hWnd)
End Sub
我打错了改为
Private Sub Command1_Click()
MsgBox GetPath
End Sub
yangzhaoyu 2001-11-06
  • 打赏
  • 举报
回复
修改如下语句
Private Sub Command1_Click()
MsgBox GetPath() 'Me.hWnd)
End Sub
cqq_chen 2001-11-06
  • 打赏
  • 举报
回复
无法执行!提示:错误的参数号或无效的属性赋值。
harp 2001-11-06
  • 打赏
  • 举报
回复
我试试。。。可以的话一定送分。。:)
foolishtiger 2001-11-06
  • 打赏
  • 举报
回复
Option Explicit

' Purpose:
' Author:吴文智
' Date:2001-1
'Description:要试用本例请在窗体中填加一个按钮
' 然后在代码窗体中粘贴如下代码
' Good luck!

Private 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

Const BIF_RETURNONLYFSDIRS = &H1
'Private pidl As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long

Function GetPath() As String
Dim bi As BROWSEINFO
Dim lngResult As Long
Dim pidl As Long
Dim Path As String
Dim pos As Integer
Dim strPath As String

'句柄
bi.hOwner = Me.hWnd
'展开根目录
bi.pidlRoot = 0&
'列表框标题
bi.lpszTitle = "请选择文档导出的路径:"
'规定只能选择文件夹,其他无效
bi.ulFlags = BIF_RETURNONLYFSDIRS
'调用API函数显示列表框
pidl = SHBrowseForFolder(bi)
'利用API函数获取返回的路径
Path = Space$(512)
lngResult = SHGetPathFromIDList(ByVal pidl&, ByVal Path)
If lngResult Then
pos = InStr(Path, Chr$(0))
strPath = Left(Path, pos - 1)
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
Else
strPath = ""
End If
GetPath = strPath
End Function

Private Sub Command1_Click()
MsgBox GetPath(Me.hWnd)
End Sub

harp 2001-11-06
  • 打赏
  • 举报
回复
晕,我那么深的功力还会问这样的问题?。。
uguess 2001-11-06
  • 打赏
  • 举报
回复
如果你对系统很熟,可以通过COM技术获得和资源管理器一样的界面,国外的站点上有很多关于这种的例子,找找吧。

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧