Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: HOw to retrive CPU id , HDD number etc.


Message #1 by "Nilesh" <nilesh_v@r...> on Mon, 25 Feb 2002 17:52:03
Hi

I know this isn't entirley what you are looking for but might be step in
the right direction.

Finding the MAC Address 
You need the WMI Core components installed and then set reference to WMI
in VB

Public Function MACAddress() As String
Dim objs As WbemScripting.SWbemObjectSet
Dim obj As WbemScripting.SWbemObject

Set objs = GetObject("winmgmts:").ExecQuery("SELECT MACAddress " & _
    "FROM Win32_NetworkAdapter " & _
    "WHERE " & _
    "((MACAddress Is Not NULL) " & _
    "AND (Manufacturer <> " & " 'Microsoft'))")

For Each obj In objs
    MACAddress = obj.MACAddress
    Debug.Print MACAddress
    Exit For
Next obj

End Function


Duncan


  Return to Index