怎样得到一个系统盘的全名,不是字符,是全名,如:本地磁盘(C:)?
发表于:2007-06-30来源:作者:点击数:
标签:
Private Sub Command1_Click() Dim ShellApp, oPanel, FolderItem1, FolderItem2, oItem Set ShellApp = CreateObject("Shell.Application") Set oPanel = ShellApp.NameSpace(0) Set FolderItem2 = Nothing For Each FolderItem1 In oPanel.Items If Folder
Private Sub Command1_Click()
Dim ShellApp, oPanel, FolderItem1, FolderItem2, oItem
Set ShellApp = CreateObject("Shell.Application")
Set oPanel = ShellApp.NameSpace(0)
Set FolderItem2 = Nothing
For Each FolderItem1 In oPanel.Items
If FolderItem1.Name = "我的电脑" Then
Set FolderItem2 = FolderItem1.Getfolder: Exit For
End If
De
bug.Print FolderItem1.Name
Next
If FolderItem2 Is Nothing Then
MsgBox "找不到项目!"
Exit Sub
End If
Set oItem = Nothing
For Each oItem In FolderItem2.Items
Debug.Print oItem.Name
Next
End Sub
输出结果如下:
控制面板3.5 软盘 (A:)
WINDOWS98 (C:)程序 (D:)本地磁盘 (E:)数据备份 (F:)光盘 (G:)
原文转自:http://www.ltesting.net