Hard Disk Serial Number - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Hard Disk Serial Number

badarbadar Posts: 1Member
Hi all

I want to pick my Hard-Disk Serial Number, Processor ID and Mother Board ID through my Visual Basic Code. I am working on a CD-Key for a Product.
Can anyone help me on it??????
Please let me know if there is any other thread here or any link you know.

Looking for your response anxiously,

Badar.

Comments

  • MicroDotMicroDot Posts: 142Member
    : Hi all
    :
    : I want to pick my Hard-Disk Serial Number, Processor ID and Mother Board ID through my Visual Basic Code. I am working on a CD-Key for a Product.
    : Can anyone help me on it??????
    : Please let me know if there is any other thread here or any link you know.
    :
    : Looking for your response anxiously,
    :
    : Badar.
    :

    Hi,

    Harddisk serial number:

    [code]

    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 Const MAX_FILENAME_LEN = 256

    Private Sub Form_Load()
    MsgBox "Serial of drive C is " & GetDriveSerial("C")
    End Sub

    Public Function GetDriveSerial(ByVal strDrv As String) As Long
    Dim lngRetVal As Long
    Dim strVNB As String * MAX_FILENAME_LEN
    Dim strFSNB As String * MAX_FILENAME_LEN
    Dim lngMCL As Long
    Dim lngFSF As Long

    Call GetVolumeInformation(strDrv & ":", _
    strVNB, _
    MAX_FILENAME_LEN, _
    lngRetVal, _
    lngMCL, _
    lngFSF, _
    strFSNB, _
    MAX_FILENAME_LEN)
    GetDriveSerial = RetVal
    End Function

    [/code]



    ProcessorID:

    [code]

    Private Sub GetCpuID()
    Dim strComputer
    Dim WMI
    Dim wmiWin32Object
    Dim wmiWin32Objects
    Dim strText

    Set WMI = GetObject("WinMgmts://" & strComputer)
    Set wmiWin32Objects = WMI.InstancesOf("Win32_Processor")

    For Each wmiWin32Object In wmiWin32Objects
    strText = "ProcessorID: " & wmiWin32Object.ProcessorId & vbCrLf
    MsgBox strText
    Next
    End Sub

    [/code]


    Hope this helps you out...


    [hr]

    [b][blue]//MicroDot[/blue][/b]

Sign In or Register to comment.