vbSun, it is not a matter of nine or ten numerals. The serial number you get from the API is in pure numerical form and you can get it to the desired format by converting into hex. In the same way, the serial number of your hard disk turns out to be 2418-FC42.
When I do a GetVolumeInformation on my C:\ drive, it gives me a serial number of 675225351. When I convert it into hex and put a '-' in it, I get 283F-1F07 which is the same that I see in a DOS box when I do a dir command.
See this code.
___
[tt]
Option Explicit
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
Private Sub Form_Load()
Dim SerialNumber As Long, S As String
'get the serial number
SerialNumber = GetSerialNumber("C:\"
'serial number in raw numerical form
MsgBox SerialNumber
'now format the serial number in its hexadecimal form
'convert to hex
S = Hex$(SerialNumber)
'pad zeroes to the left
S = Right$("00000000" & S, 8)
'put a "-" in the middle
S = Left$(S, 4) & "-" & Right$(S, 4)
'serial number in generic hexadecimal form
MsgBox S
Unload Me
End Sub
Function GetSerialNumber(RootPath As String) As Long
GetVolumeInformation RootPath, vbNullString, 0, GetSerialNumber, ByVal 0&, ByVal 0&, vbNullString, 0
End Function[tt]