Results 1 to 6 of 6

Thread: HDD (Manufacturer) Serial Number

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    10

    Exclamation

    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

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    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
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    10

    Cool

    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

  4. #4
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611

    Unhappy

    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

  5. #5
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    You have to add a reference to the scrrun.dll. Go to Project->References->Browse and add the scrrun.dll.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  6. #6
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611

    Thumbs up 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
  •  



Click Here to Expand Forum to Full Width