?
Solved

How to get the MotherBoard serial number using Visual basic?

Posted on 2003-02-28
6
Medium Priority
?
792 Views
Last Modified: 2013-11-25
How to the get MotherBoard serial number?

or any unique number can indentify a computer?

I had tired MAC Address, but it doesn't work without network card.

Thank You.
0
Comment
Question by:morye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8041298
I think you can get it using this free ActiveX: http://farwalk.51.net/
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 200 total points
ID: 8041839
0
 

Author Comment

by:morye
ID: 8054424
To EDDYKT,

I had tired the source code already, but it can't get the mother board number.


To emoreau,

Thank for the site, but I need to combine this function into my program. So, I would like to have the source code ....

Thank You~

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8054482
why don't you add the OCX to your project?
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 8056851
why not

On hte link you should see

Obtaining Baseboard (Motherboard) Information using WMI



click on the link and use the code.

On the bottom you can use serialnumber

A reference set in Projects / References to the Microsoft WMI Scripting Library.

Add commandbutton and listview on your form


ie
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2003 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce
'               or publish this code on any web site,
'               online service, or distribute as source
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/* used for listview column auto-resizing
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_SETCOLUMNWIDTH As Long = (LVM_FIRST + 30)
Private Const LVSCW_AUTOSIZE As Long = -1
Private Const LVSCW_AUTOSIZE_USEHEADER As Long = -2

Private Declare Function SendMessage Lib "user32" _
   Alias "SendMessageA" _
  (ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   lParam As Any) As Long


Private Sub Form_Load()

   With ListView1
      .ListItems.Clear
      .ColumnHeaders.Clear
      .ColumnHeaders.Add , , "Product"
      .ColumnHeaders.Add , , "Serial number"
      .View = lvwReport
      .Sorted = False
   End With
   
   Command1.Caption = "BaseBoard Info"

End Sub


Private Sub Command1_Click()

   ListView1.ListItems.Clear
   Call wmiBaseBoardInfo
   Call lvAutosizeControl(ListView1)
   
End Sub


Private Sub lvAutosizeControl(lv As ListView)

   Dim col2adjust As Long

  '/* Size each column based on the maximum of
  '/* EITHER the columnheader text width, or,
  '/* if the items below it are wider, the
  '/* widest list item in the column
   For col2adjust = 0 To lv.ColumnHeaders.Count - 1
   
      Call SendMessage(lv.hwnd, _
                       LVM_SETCOLUMNWIDTH, _
                       col2adjust, _
                       ByVal LVSCW_AUTOSIZE_USEHEADER)

   Next
   
End Sub


Private Sub wmiBaseBoardInfo()

   Dim BaseBoardSet
   Dim bb
   Dim itmx As ListItem
   
   Set BaseBoardSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                                 InstancesOf("Win32_BaseBoard")
     
   On Local Error Resume Next
   
   For Each bb In BaseBoardSet
   
      Set itmx = ListView1.ListItems.Add(, , bb.Product)
      itmx.SubItems(1) = bb.serialnumber
   
   Next

End Sub


0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 8056854
why not

On hte link you should see

Obtaining Baseboard (Motherboard) Information using WMI



click on the link and use the code.

On the bottom you can use serialnumber

A reference set in Projects / References to the Microsoft WMI Scripting Library.

Add commandbutton and listview on your form


ie
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2003 VBnet, Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce
'               or publish this code on any web site,
'               online service, or distribute as source
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/* used for listview column auto-resizing
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_SETCOLUMNWIDTH As Long = (LVM_FIRST + 30)
Private Const LVSCW_AUTOSIZE As Long = -1
Private Const LVSCW_AUTOSIZE_USEHEADER As Long = -2

Private Declare Function SendMessage Lib "user32" _
   Alias "SendMessageA" _
  (ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   lParam As Any) As Long


Private Sub Form_Load()

   With ListView1
      .ListItems.Clear
      .ColumnHeaders.Clear
      .ColumnHeaders.Add , , "Product"
      .ColumnHeaders.Add , , "Serial number"
      .View = lvwReport
      .Sorted = False
   End With
   
   Command1.Caption = "BaseBoard Info"

End Sub


Private Sub Command1_Click()

   ListView1.ListItems.Clear
   Call wmiBaseBoardInfo
   Call lvAutosizeControl(ListView1)
   
End Sub


Private Sub lvAutosizeControl(lv As ListView)

   Dim col2adjust As Long

  '/* Size each column based on the maximum of
  '/* EITHER the columnheader text width, or,
  '/* if the items below it are wider, the
  '/* widest list item in the column
   For col2adjust = 0 To lv.ColumnHeaders.Count - 1
   
      Call SendMessage(lv.hwnd, _
                       LVM_SETCOLUMNWIDTH, _
                       col2adjust, _
                       ByVal LVSCW_AUTOSIZE_USEHEADER)

   Next
   
End Sub


Private Sub wmiBaseBoardInfo()

   Dim BaseBoardSet
   Dim bb
   Dim itmx As ListItem
   
   Set BaseBoardSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
                                 InstancesOf("Win32_BaseBoard")
     
   On Local Error Resume Next
   
   For Each bb In BaseBoardSet
   
      Set itmx = ListView1.ListItems.Add(, , bb.Product)
      itmx.SubItems(1) = bb.serialnumber
   
   Next

End Sub


0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question