Private Sub Command1_Click() Select Case GetDriveType("C:\") Case 0 MsgBox "未知类型",vbExclamation Case 1 MsgBox "未知类型",vbCritical Case 2 MsgBox "可移动磁盘",vbinformation Case 3 MsgBox "本机磁盘",vbinformation Case 4 MsgBox "网络磁盘",vbinformation Case 5 MsgBox "光驱",vbinformation Case 6 MsgBox "内存虚拟磁盘",vbinformation End Select End Sub 检测有无移动磁盘插入 Option Explicit Private Declare Function GetDriveType lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long Private Sub Command1_Click() If Ydcp() = False Then MsgBox "没有检测到移动磁盘" Else MsgBox "检测到移动磁盘" End Sub Private Function Ydcp() As Boolean Dim i As Integer Ydcp = False For i = 65 To 90 If GetDriveType(Chr(i) & ":\") = 2 Then Ydcp = True Exit Function End If Next i End Function 总结
以上是内存溢出为你收集整理的vb检查磁盘类型全部内容,希望文章能够帮你解决vb检查磁盘类型所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)