|
Просмотреть все устройства и определить их тип |
|
|
(жесткий диск, дисковод, CD-ROM, сетевой диск, ...)
Расположите на форме элемент ListBox. Private Declare Function GetDriveType Lib "kernel32" Alias
"GetDriveTypeA" (ByVal nDrive As String) As Long
Const DRIVE_CDROM = 5
Const DRIVE_FIXED = 3
Const DRIVE_RAMDISK = 6
Const DRIVE_REMOTE = 4
Const DRIVE_REMOVABLE = 2
Dim strDrive As String
Dim strMessage As String
Dim intCnt As Integer
Private Sub Form_Load()
For intCnt = 65 To 86
strDrive = Chr(intCnt)
Select Case GetDriveType(strDrive + ":\")
Case DRIVE_REMOVABLE
rtn = "Floppy Drive"
Case DRIVE_FIXED
rtn = "Hard Drive"
Case DRIVE_REMOTE
rtn = "Network Drive"
Case DRIVE_CDROM
rtn = "CD-ROM Drive"
Case DRIVE_RAMDISK
rtn = "RAM Disk"
Case Else
rtn = ""
End Select
If rtn <> "" Then
List1.AddItem "Drive " & strDrive & " is type: " & rtn
'strMessage = strMessage & vbCrLf & "Drive " & strDrive & "
is type: " & rtn
End If
Next intCnt
'MsgBox (strMessage)
End Sub
|
|
|
|
|
|
|