INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How To Get A Drive Serial Number  (Read 1585 times)

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20048
How To Get A Drive Serial Number
« on: October 06, 2003, 08:35:50 am »

this could be used to make sure this is the same user, or maybe if a user submits data and you use this to make sure the user submits data only once.


Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long
Function GetSerialNumber(strDrive As String) As Long
   Dim SerialNum As Long
   Dim Res As Long
   Dim Temp1 As String
   Dim Temp2 As String
   Temp1 = String$(255, Chr$(0))
   Temp2 = String$(255, Chr$(0))
   Res = GetVolumeInformation(strDrive, Temp1, _
   Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
   DriveSerialNumber.Text = SerialNum
End Function

Private Sub CmdGetSerialNum_Click()

Call GetSerialNumber("C:\")

End Sub
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio
https://MyAAGrapevines.com
Fayetteville, NC, USA
Pages: [1]   Go Up