获取光盘序列号

Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long

Sub main()
Dim driveinfo As String, i As Byte
For i = 0 To 25
driveinfo = Chr(i + 65) & ":"
If GetDriveType(driveinfo) = 5 Then Exit For
Next
driveinfo = GetObject("WinMgmts::Win32_LogicalDisk='" & driveinfo & "'").VolumeSerialNumber
MsgBox driveinfo
End Sub 

你可能感兴趣的:(序列)