'获得硬盘C盘序列号
Function GetDrvID() As Long
Dim GetVal As Long
Dim TempStr1 As New String(Chr(0), 255)
Dim TempStr2 As New String(Chr(0), 255)
Dim TempLon1 As Integer
Dim TempLon2 As Integer
Dim lres As Integer
lres = GetVolumeInformation("D:", TempStr1, 256, GetVal, TempLon1, TempLon2, TempStr2, 256)
Return GetVal
End Function
Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, ByRef lpVolumeSerialNumber As Long, ByVal lpMaximumComponentLength As Integer, ByVal lpFileSystemFlags As Integer, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Integer) As Integer