VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Retrieve a disk drives serial number

by C.J. (13 Submissions)
Category: Windows System Services
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Tue 2nd March 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Retrieve a disk drives serial number

API Declarations


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)


Rate Retrieve a disk drives serial number




'  Returns a volume's serial number
'
Public Function GetSerialNumber(sDrive As String) As Long
   Dim ser 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, ser, i, j, s2, MAX_FILENAME_LEN)
   GetSerialNumber = ser
End Function

Download this snippet    Add to My Saved Code

Retrieve a disk drives serial number Comments

No comments have been posted about Retrieve a disk drives serial number. Why not be the first to post a comment about Retrieve a disk drives serial number.

Post your comment

Subject:
Message:
0/1000 characters