vb检查磁盘类型
2013-12-05 17:02
316 查看
Option Explicit
Private Declare Function GetDriveType Lib "kernel32.dll" Alias
"GetDriveTypeA" (ByVal nDrive As String) As Long
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
Private Declare Function GetDriveType Lib "kernel32.dll" Alias
"GetDriveTypeA" (ByVal nDrive As String) As Long
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.NET函数——检查数据类型函数
- VB.NET String数据类型操作技巧
- VB.Net实现打印机纸张类型自动更换的方法
- 【技术分享】之虚拟化类型,虚拟化磁盘镜像格式
- 用模板来进行类型检查。
- VB.Net思路:检查控件,设置控件权限
- VB.NET类型单位命名规则介绍
- VB.Net 数据类型,变量申明字符
- z/OS磁盘类型及其空间计算方法
- 检查DNT.config中Dbtype节点数据库类型是否正确,例如:SqlServer、Access、MySql
- Dicom检查类型
- VB 常数 数据类型 编译指令
- 服务器端检查上传文件类型(可以检测真正文件名)
- Java SE7新特性之捕获多种类型的异常并且重新抛出使用改进的类型检查的异常
- VB.NET检查IP地址是否合法函数
- (void)sizeof(type_must_be_complete)检查不完全类型
- Ubuntu 14.04无U盘光盘在线安装完之后,重启之后出现“为/检查磁盘时发现严重错误。“的解决方法
- 【原】VC检测磁盘类型(代码)
- Python中的对象行为与特殊方法(二)类型检查与抽象基类
- 编译器开发系列--Ocelot语言4.类型定义的检查