We have a VB6 app which uses the computer's C: drive serial number for security. We have the App installed on computer B, and it runs fine on computer B. The app can read the serial number from computer B's C drive. When accessing the app from computer A on shared computer B over the LAN, the app reads the C: driver serial number from computer A, not computer B. I need to know how to read the C: driver serial number from computer B, the computer with the app installed.
Here's the code I use:
Public Function GetSerialNumber( _
ByVal sDrive As String) As Long
If Len(sDrive) Then
If InStr(sDrive, "\\") = 1 Then
' Make sure we end in backslash for UNC
If Right$(sDrive, 1) <> "\" Then
sDrive = sDrive & "\"
' If not UNC, take first letter as drive
sDrive = Left$(sDrive, 1) & ":\"
' Else just use current drive
sDrive = vbNullString
' Grab S/N -- Most params can be NULL
Call GetVolumeInformation( _
sDrive, vbNullString, 0, GetSerialNumber, _
ByVal 0&, ByVal 0&, vbNullString, 0)