للحصول على رقم السيريل نمبر لأول سواقة ليزرية:
- التفاصيل
- الزيارات: 3487
كود:
Public Const DRIVE_CDROM = 5
Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long
Public 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
Public Function FirstCDSN() As String
Dim CDs As String
Dim I As Byte
Dim Found As Boolean
Dim sVL As String
Dim lTemp1 As Long
Dim lTemp2 As Long
Dim sTemp3 As String
Dim lSN As Long
CDs = "DEFGHIJKLMNOPQRSTUVWXYZ"
Found = False
I = 0
While (I <> Len(CDs)) And (Not Found)
I = I + 1
If GetDriveType(Mid(CDs, I, 1) + ":") = DRIVE_CDROM Then Found = True
Wend
GetVolumeInformation Mid(CDs, I, 1) + ":", sVL, 50, lSN, lTemp1, lTemp2, sTemp3, 50
FirstCDSN = Right("00000000" + Hex(lSN), 8)
End Function