|
-
Dec 11th, 2000, 06:28 AM
#1
Thread Starter
New Member
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
-----------------------------------
No Other Life form is Found but 1 do exist in my HDD
-
Dec 11th, 2000, 04:43 PM
#2
Frenzied Member
Try this
Code:
Dim f As FileSystemObject
Set f = New FileSystemObject
Dim d As Drive
Set d = f.GetDrive("c")
Form1.Caption = d.SerialNumber 'contains serial number
-
Dec 13th, 2000, 09:16 PM
#3
Thread Starter
New Member
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
-----------------------------------
No Other Life form is Found but 1 do exist in my HDD
-
Dec 14th, 2000, 09:46 AM
#4
Fanatic Member
Hi - I just get a userdefined type not defined from this
K
Originally posted by Vlatko
Try this
Code:
Dim f As FileSystemObject
Set f = New FileSystemObject
Dim d As Drive
Set d = f.GetDrive("c")
Form1.Caption = d.SerialNumber 'contains serial number
-
Dec 14th, 2000, 10:44 AM
#5
Frenzied Member
You have to add a reference to the scrrun.dll. Go to Project->References->Browse and add the scrrun.dll.
-
Dec 14th, 2000, 03:17 PM
#6
Fanatic Member
Retrieving a disk's serial number
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
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
|