|
vbAccelerator - Contents of code file: frmDeviceNames.frmThis file is part of the download Device Names Sample, which is described in the article Mapping NT Device Names to Drive Letters and vice-versa. VERSION 5.00
Begin VB.Form frmDeviceNames
Caption = "Device Name/Drive Letter Demonstration"
ClientHeight = 3225
ClientLeft = 4110
ClientTop = 2790
ClientWidth = 5190
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmDeviceNames.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3225
ScaleWidth = 5190
Begin VB.ListBox lstDevices
Height = 2205
Left = 120
TabIndex = 1
Top = 420
Width = 4995
End
Begin VB.CommandButton cmdRefresh
Caption = "&Refresh"
Height = 435
Left = 3900
TabIndex = 0
Top = 2700
Width = 1215
End
Begin VB.Label Label1
Caption = "Drive letters and devices:"
Height = 255
Left = 120
TabIndex = 2
Top = 120
Width = 4935
End
End
Attribute VB_Name = "frmDeviceNames"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Function NameForDriveType(ByVal eType As EDriveType)
Select Case eType
Case DRIVE_CDROM
NameForDriveType = "CD"
Case DRIVE_REMOVABLE
NameForDriveType = "Removable"
Case DRIVE_FIXED
NameForDriveType = "HD"
Case DRIVE_REMOTE
NameForDriveType = "Network Drive"
Case DRIVE_RAMDISK
NameForDriveType = "RAM Disc"
Case Else
NameForDriveType = "Unknown"
End Select
End Function
Private Sub ShowDevices()
Dim vDrive As Variant
Dim sDeviceName As String
Dim eType As EDriveType
lstDevices.Clear
For Each vDrive In GetDrives()
sDeviceName = GetNtDeviceNameForDrive(vDrive)
eType = GetDriveType(vDrive)
lstDevices.AddItem vDrive & vbTab & NameForDriveType(eType) & vbTab &
sDeviceName
Next
End Sub
Private Sub cmdRefresh_Click()
ShowDevices
End Sub
Private Sub Form_Load()
ShowDevices
End Sub
|
|||
|
|
||||
|
|
||||