DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Retrieve Machine Information

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Retrieve Machine Information

    [Originally posted by shirshendu paul]

    sir,

    how can i retrieve the mother board serial no or unique mashine id using visual basic.

    iam using wmi scripting lib. but it is returning "0000000 " and in other machine it is blank

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Retrieve Machine Information

    [Originally posted by neophile]

    Did you already catch this?...
    http://freevbcode.com/ShowCode.Asp?ID=2664

    If so, I don't know what to do. However, you could get the serial number of a harddrive fairly easy...



    Option Explicit

    Private 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

    Public Function DriveSerial(ByVal Drive As String) As Long
    If Drive <> "" Then
    Drive = UCase(Left(Drive, 1)) & ":\"
    Call GetVolumeInformation(Drive, vbNullString, 0, DriveSerial, 0, 0, vbNullString, 0)
    End If
    End Function



    Immediate Pane Example:
    ?DriveSerial("C")
    939354681

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Retrieve Machine Information

    [Originally posted by neophile]

    Did you already catch this?...
    http://freevbcode.com/ShowCode.Asp?ID=2664

    If so, I don't know what to do. However, you could get the serial number of a harddrive fairly easy...



    Option Explicit

    Private 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

    Public Function DriveSerial(ByVal Drive As String) As Long
    If Drive <> "" Then
    Drive = UCase(Left(Drive, 1)) & ":\"
    Call GetVolumeInformation(Drive, vbNullString, 0, DriveSerial, 0, 0, vbNullString, 0)
    End If
    End Function



    Immediate Pane Example:
    ?DriveSerial("C")
    939354681

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Also...

    [Originally posted by neophile]

    This might only work on motherboards that support the feature? Just a shot in the dark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center