aamer
Jun 20th, 1999, 07:48 PM
I am in need to get the Volume and serial No. of my Hard Disk with Visual Basic 5. The "Dir" command gave me the volume but I also want the Serial No. (Similar to Vol command in DOS).
Serge
Jun 22nd, 1999, 03:35 PM
Declare this on General declaration of a module:
Public 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
Then put this on any event:
Dim strDrive
Dim lRet As Long
Dim strFileSystem As String
Dim strVolName As String
Dim lSerialNumber As Long
strDrive = "C:\" 'change to any drive letter here
strFileSystem = Space(255)
strVolName = Space(255)
lRet = GetVolumeInformation(strDrive, strVolName, Len(strVolName), lSerialNumber, 255, 1, strFileSystem, Len(strFileSystem))
MsgBox "Volume Name: " & strVolName & vbcrlf & "Serial Number: " & lSerialNumber
Best regards,
------------------
Serge
Serge_Dymkov@vertexinc.com
Access8484@aol.com
If you have any questions about AOL programming, e-mail me