Доброе время суток всем.
Подскажите, если кто знает, каким образом можно узнать идентификационный номер дискеты с помощью программного кода VB?
strComputer = "."
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery( _
"Select * from Win32_Logicaldisk")
For Each objItem in colItems
If (objItem.DriveType=2) And ((objItem.FileSystem="FAT12") Or (objItem.FileSystem="FAT16")) Then WScript.Echo "Diskette Serial Number is " & objItem.VolumeSerialNumber
Next
Private Sub Form_Load()
Dim objWMIService As Object, strComputer As String
strComputer = "."
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery( _
"Select * from Win32_Logicaldisk")
For Each objItem In colItems
If (objItem.DriveType = 2) And ((objItem.FileSystem = "FAT12") Or (objItem.FileSystem = "FAT16")) Then
WScript.Echo "Diskette Serial Number is " & objItem.VolumeSerialNumber
If Not IsNull(objItem.VolumeSerialNumber) Then Debug.Print CStr(objItem.VolumeSerialNumber)
end if
Next
End Sub
Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Sub Form_Load()
Dim Serial As Long
GetVolumeInformation "a:\", "", 255, Serial, 0, 0, "", 255
MsgBox Serial
End Sub
Sirik писал(а):зы. это не заводской номер дискеты, он "даётся" при форматировании диска
Сейчас этот форум просматривают: AhrefsBot и гости: 119