Categories




get drive serial number

Private Const MAX_FILENAME_LEN = 256
Private Declare Function GetVolumeInformation& Lib “kernel32″ Alias “GetVolumeInformationA” _
(ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long)

Public Function GetSerialNumber(sDrive As String) As Long
Dim serial As Long
Dim s As String * MAX_FILENAME_LEN
Dim s2 As String * MAX_FILENAME_LEN
Dim i As Long
Dim j As Long

Call GetVolumeInformation(sDrive + “:” & Chr$(0), s, MAX_FILENAME_LEN, serial, i, j, s2, MAX_FILENAME_LEN)
GetSerialNumber = serial
End Function

Private Sub Form_Load()
MsgBox GetSerialNumber(“d”)
End Sub

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>