|
-
Jun 20th, 1999, 07:48 PM
#1
Thread Starter
Junior Member
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).
-
Jun 22nd, 1999, 03:35 PM
#2
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
[email protected]
[email protected]
If you have any questions about AOL programming, e-mail me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|