PDA

Click to See Complete Forum and Search --> : HDD (Manufacturer) Serial Number


Kristopher
Dec 11th, 2000, 05:28 AM
Hi,

Can anyone help me on how to obtain the HDD Manufacturer Serial Number? I need it urgently.

I read one of the threads here, they sez use GUID in Registry or WMI but i'm not sure about that also. Can anyone explain it to me?

Thank you

Vlatko
Dec 11th, 2000, 03:43 PM
Try this

Dim f As FileSystemObject
Set f = New FileSystemObject
Dim d As Drive
Set d = f.GetDrive("c")
Form1.Caption = d.SerialNumber 'contains serial number

Kristopher
Dec 13th, 2000, 08:16 PM
Can this code be used in VB5 or VB6?
as i'm using VB5 currently, and what class or components that are needed to run this code?

Thx u

Kzin
Dec 14th, 2000, 08:46 AM
Hi - I just get a userdefined type not defined from this

K


Originally posted by Vlatko
Try this

Dim f As FileSystemObject
Set f = New FileSystemObject
Dim d As Drive
Set d = f.GetDrive("c")
Form1.Caption = d.SerialNumber 'contains serial number

Vlatko
Dec 14th, 2000, 09:44 AM
You have to add a reference to the scrrun.dll. Go to Project->References->Browse and add the scrrun.dll.

Kzin
Dec 14th, 2000, 02:17 PM
Retrieving a disk's serial number
--------------------------------------------------------------------------------
Add this code to a new module:
Declare Function GetVolumeInformation _
Lib "kernel32.dll" _
Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long _
) As Long

Function GetSerialNumber(sDrive As String) As Long
Dim lSerial As Long
Dim lRetVal As Long
Dim sTempA As String
Dim sTempB As String
sTempA = String$(255, Chr$(0))
sTempB = String$(255, Chr$(0))
lRetVal = GetVolumeInformation(sDrive, sTempA, Len(sTempA), lSerial, 0, 0, sTempB, Len(sTempB))
GetSerialNumber = lSerial
End Function

The GetVolumeInformation function also allows you to get other information about a disk, not only it's serial number, but most of the other parts are normally unused (unless you're a real power user)
To use this function, simply call when necessary:
Dim lSerialNum as Long
...
Private Sub Form_Load()
lSerialNum = GetSerialNumber("C:\")

' Do something with the serial number, for example check that
' this computer is authorised to use the program
End Sub




Originally posted by Kristopher
Hi,

Can anyone help me on how to obtain the HDD Manufacturer Serial Number? I need it urgently.

I read one of the threads here, they sez use GUID in Registry or WMI but i'm not sure about that also. Can anyone explain it to me?

Thank you