例如机器上有三个光驱:
E--放CD
F--放VCD
G-放DVD
怎么获得E、F、G盘,并能获得光驱里光盘的类型
E--放CD
F--放VCD
G-放DVD
怎么获得E、F、G盘,并能获得光驱里光盘的类型
解决方案 »
- 如何截获数据库连接错误?
- VB 如何读取含有特殊不能识别字符的文本?如:“ ”.
- 急啊~~~~vb求平均值啊!!!!跪求高手帮助啊~~~~
- 焦点问题?
- 求高手解:webbrowser控件的这段代码是什么意思?(是写到网页里????)
- 在线求助 100分相送
- 用VB怎样做像SQL SERVER的服务器,就是在右下角的那个???
- 我关于网络通讯解决方案的问题想求教各位,多多帮忙了!!!
- PICTURE控件的属性HEIGHT与SCALEHEIGHT有何区别?100分
- gdiplus 创建路径填充图形
- 关于合并记录集的问题,谢谢大家了
- 动态加载控件,Frame中有textbox 和combox,在动态加载后只显示Frame,为什么呢?
Select Case intDriveType
Case 0: getDriveType = "Unknown"
Case 1: getDriveType = "Removable"
Case 2: getDriveType = "Fixed"
Case 3: getDriveType = "Network"
Case 4: getDriveType = "CD-ROM"
Case 5: getDriveType = "RAM Disk"
End Select
End FunctionPrivate Sub Command2_Click()
Dim x As New Scripting.FileSystemObject
Dim y As Scripting.Drive
For Each y In x.Drives
MsgBox getDriveType(y.DriveType)
Next
End Sub
http://codeguru.com/misc/cdEject.html
Dim b() As IntegerPrivate Function CheckCD(ByRef Disks() As String, ByRef CDType() As Integer) As Integer
Dim fso As New Scripting.FileSystemObject
Dim dri As Scripting.Drive
Dim i As Integer
CheckCD = 0
i = 0
On Error GoTo ErrHandler
For Each dri In fso.Drives
'判断是否是CD-ROM
If dri.DriveType = 4 Then
i = i + 1
ReDim Disks(i) As String
ReDim CDType(i) As Integer
If Dir(dri.Path & "\*.CDA") <> "" Then
'CD
Disks(i) = dri.Path
CDType(i) = 1
CheckCD = 1
ElseIf Dir(dri.Path & "\MPEGAV", vbDirectory) <> "" Then
'VCD
Disks(i) = dri.Path
CDType(i) = 2
CheckCD = 1
ElseIf Dir(dri.Path & "\VIDEO_TS", vbDirectory) <> "" And Dir(dri.Path & "\VIDEO_TS", vbDirectory) <> "" Then
'DVD
Disks(i) = dri.Path
CDType(i) = 3
CheckCD = 1
End If
End If
Next
Exit Function
ErrHandler:
CheckCD = 0
End FunctionPrivate Sub Command1_Click()
Dim i As Integer
If CheckCD(a(), b()) Then
For i = 1 To UBound(a)
MsgBox a(i) & b(i)
Next i
End If
End Sub