FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Motherboard Serial Number
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Motherboard Serial Number
Posted: Fri Feb 23, 2007 06:56 PM

Hi Everybody,

Anyone know how to read the serial number of a motherboard?

Thanks,
Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Motherboard Serial Number
Posted: Fri Feb 23, 2007 09:42 PM
I found some VB code that should get the Motherboard Serial number.

Can anyone convert this to FWH ?


Jeff

Public Function MBSerialNumber() As String

'RETRIEVES SERIAL NUMBER OF MOTHERBOARD
'IF THERE IS MORE THAN ONE MOTHERBOARD, THE SERIAL
'NUMBERS WILL BE DELIMITED BY COMMAS

'YOU MUST HAVE WMI INSTALLED AND A REFERENCE TO
'Microsoft WMI Scripting Library IS REQUIRED

Dim objs As Object

Dim obj As Object
Dim WMI As Object
Dim sAns As String


Set WMI = GetObject("WinMgmts:")
Set objs = WMI.InstancesOf("Win32_BaseBoard")
For Each obj In objs
  sAns = sAns & obj.SerialNumber
 If sAns < objs.Count Then sAns = sAns & ","
Next
MBSerialNumber = sAns
End Function
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Motherboard Serial Number
Posted: Fri Feb 23, 2007 11:58 PM
FUNCTION MAIN()

    LOCAL oLoc := CREATEOBJECT( "wbemScripting.SwbemLocator" )
    LOCAL oSrv := oLoc:ConnectServer()
    LOCAL oJbs := oSrv:ExecQuery( "SELECT * FROM Win32_BaseBoard" )

    LOCAL oJob

    FOR EACH oJob IN oJbs
        ? oJob:SerialNumber
    NEXT

    RETURN NIL
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Motherboard Serial Number
Posted: Sat Feb 24, 2007 02:03 AM

Once again many thanks. :D

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Motherboard Serial Number
Posted: Sat Feb 24, 2007 03:08 AM

Hi

"wbemScripting.SwbemLocator" object is available where ?

Is is available in Win98 also ?

Thanks

  • Ramesh Babu P
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Motherboard Serial Number
Posted: Sat Feb 24, 2007 09:49 AM
It should be available. From MSDN:

Client Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0 SP4 and later, Windows Me, Windows 98, or Windows 95 OSR2 and later.
Server Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0 SP4 and later.
Type Library Use Wbemdisp.tlb.

DLL Requires Wbemdisp.dll.


EMG

Continue the discussion