Hard drive serial number 
Author Message
 Hard drive serial number

Can anyone please help.

Is there a API call to read the serial number of the local Hard drive using
VB.

Thanks
Mahindra Morar



Sun, 23 Apr 2000 03:00:00 GMT  
 Hard drive serial number

Here's a quick demo.  Paste this into a form with a command button on
it.  It will print the serial number (and some other info) on the form.
You can change the drive letter to the appropriate one for your needs.
This also works on floppies CD-Roms.
-Dave

Option Explicit
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 Command1_Click()
Dim SerialNum As Long
    Dim Temp1 As String
    Dim Temp2 As String
    Dim RetVal As Long
    Temp1 = Space(256)
    Temp2 = Space(256)
   RetVal = GetVolumeInformation("c:\", Temp1, Len(Temp1), SerialNum, 0,
0, Temp2, Len(Temp2))

    Print SerialNum & vbCrLf & Temp1 & vbCrLf & Temp2

End Sub

Quote:

> Can anyone please help.

> Is there a API call to read the serial number of the local Hard drive using
> VB.

> Thanks
> Mahindra Morar



Sun, 23 Apr 2000 03:00:00 GMT  
 Hard drive serial number

Try the following API:

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

Hope this helps

-Sai Kayal



Quote:
> Can anyone please help.

> Is there a API call to read the serial number of the local Hard drive
using
> VB.

> Thanks
> Mahindra Morar



Sun, 23 Apr 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Hard Drive Serial Number/Total Drive Size

2. hard drive serial number

3. Reading the Hard Drives Serial Number

4. Hard Drive Serial Number

5. Hard drive serial number

6. Getting Hard Drive Serial number

7. API call for hard drive serial number

8. Hard Drive Serial Numbers

9. Hard Drive Serial Numbers

10. Get hard drive serial numbers

11. Hard Drive Serial Number?

12. Hard Drive Volume Serial Number

 

 
Powered by phpBB® Forum Software