Anyone know how to access the serial number and/or model number of the c: drive on the host machine (i.e. the root of app.path)?
HELP.
Thanx
Pigmy
:rolleyes:
Printable View
Anyone know how to access the serial number and/or model number of the c: drive on the host machine (i.e. the root of app.path)?
HELP.
Thanx
Pigmy
:rolleyes:
VB Code:
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 GetVolume(PathName As String, DrvVolumeName As String, DrvSerialNo As String) Dim r As Long Dim pos As Integer Dim hword As Long Dim HiHexStr As String Dim lword As Long Dim LoHexStr As String Dim VolumeSN As Long Dim MaxFNLen As Long Dim UnusedStr As String Dim UnusedVal1 As Long Dim UnusedVal2 As Long 'pad the strings DrvVolumeName$ = Space$(14) UnusedStr$ = Space$(32) 'do what it says r = GetVolumeInformation(PathName, DrvVolumeName, Len(DrvVolumeName), VolumeSN&, UnusedVal1, UnusedVal2, UnusedStr, Len(UnusedStr$)) 'error check If r& = 0 Then Exit Sub 'determine the volume label pos = InStr(DrvVolumeName, Chr$(0)) If pos Then DrvVolumeName = Left$(DrvVolumeName, pos - 1) If Len(Trim$(DrvVolumeName)) = 0 Then DrvVolumeName = "(no label)" hword = HiWord(VolumeSN) lword = LoWord(VolumeSN) HiHexStr = Format$(Hex(hword), "0000") LoHexStr = Format$(Hex(lword), "0000") DrvSerialNo = HiHexStr & "-" & LoHexStr End Sub Private Function HiWord(dw As Long) As Integer HiWord = (dw And &HFFFF0000) \ &H10000 End Function Private Function LoWord(dw As Long) As Integer If dw And &H8000& Then LoWord = dw Or &HFFFF0000 Else LoWord = dw And &HFFFF& End If End Function 'To Display The Volume Name And Serial Number: Dim PathName As String Dim DrvVolumeName As String Dim DrvSerialNo As String PathName$ = "c:\" GetVolume PathName, DrvVolumeName, DrvSerialNo MsgBox "Drive Statistics for " & UCase$(PathName) & ": " & "Volume Label " & DrvVolumeName & ", " & "Volume Serial No " & DrvSerialNo
Wow,
Comprehensive and FAST too!!!!
Thanx a Million!
Pigmy
:D :D :D :D :D
My pleasure....:D