DECLARE A 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
DEPOIS É SO CRIAR A FUNCTION ABAIXO
Function G_Num_Serial_HD() As String
'verifica n. Serial da HD
On Error GoTo Err_G_Num_Serial_HD
Dim Disque As String, NomVolume As String * 15, NumSerie As Long, Serie As String
Dim ResStr As String * 32, dum As Long, retval As Long, T_Serie As String * 9, T_NomVolume As String * 15
retval = GetVolumeInformation(Disque, NomVolume, Len(NomVolume), NumSerie, dum, dum, ResStr, Len(ResStr))
Serie = Right(String(8, "0") + Hex$(NumSerie), 8)
G_Num_Serial_HD = Left(Serie, 4) + "-" + Right$(Serie, 4)
Exit Function
Err_G_Num_Serial_HD:
MSGBOX("Erro na Leitura do Serial da HD")
End Function