Em um modulo:
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 DriveSerial(ByVal Drive As _
String) As Long
'Valor que retornará o serial do HD
Dim RetVal As Long
Dim HDNameBuffer As String * 256 'Nome do HD
Dim FSBuffer As String * 256 'FS do HD
Dim a As Long 'auxiliar
Dim b As Long 'auxiliar
Call GetVolumeInformation(Drive, HDNameBuffer, _
256, RetVal, a, b, FSBuffer, 256)
DriveSerial = RetVal
End Function
Para Chamar a Funcao:
msgbox Trim(DriveSerial("C:"))