1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| 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
Public Function GetDiskSerial() As String
Dim Serial As Long
Dim VName As String
Dim FSName As String
VName = String$(255, Chr$(0))
FSName = String$(255, Chr$(0))
GetVolumeInformation "C:\", VName, 255, Serial, 0, 0, FSName, 255
GetDiskSerial = CStr(Serial)
End Function |
Partager