04-02-2009, 03:28 AM
Hello Gintaras
I have a question, how to make this ActiveX to work and get the current instance of WinMgmts: ?
[/code]
i would like to make this works like the vbscript code below
Thank you.
Regards.
I have a question, how to make this ActiveX to work and get the current instance of WinMgmts: ?
Macro [help1][/help1]
[code]
;typelib wmi {172BDDF8-CEEA-11D1-8B05-00600806D9B6} 2
;typelib Excel {00020813-0000-0000-C000-000000000046} 1.2
;typelib wmi {C10B4771-4DA0-11D2-A2F5-00C04F86FB7D} .1
typelib wmi "C:\Windows\System32\wbem\wbemdisp.tlb"
wmi.SWbemObjectSet ab
wmi.SWbemObjectSet aa
aa=ab._getactive("" 1 "")
out aa.ItemIndex(1)
;ab=ab._getactive(0 16)
;IAccessible an
;wmi.SWbemObject dab
;out ab.InstancesOf("Win32_SystemEnclosure" 0 0).ItemIndex(1)
i would like to make this works like the vbscript code below
Quote:Dim objs As Object
Dim obj As Object
Dim WMI As Object
Dim sAns As String
'if Win32_BaseBoard doesnt work try SystemEnclosure..
Set WMI = GetObject("WinMgmts:")
'Set objs = GetObject("WinMgmts:Win32_BaseBoard")
'Set objs = WMI.InstancesOf("Win32_BaseBoard")
Set objs = WMI.InstancesOf("Win32_SystemEnclosure")
For Each obj In objs
sAns = sAns & obj.SerialNumber
If sAns < objs.Count Then sAns = sAns & ","
Next
MBSerialNumber = sAns
End Function
Private Sub Form_Load()
mboard = MBSerialNumber()
MsgBox mboard
End Sub
this code was taken from:
http://www.programmersheaven.com/mb/Can ... /?S=B10000
Thank you.
Regards.