Results 1 to 2 of 2

Thread: Working with WMI from vb6

  1. #1

    Thread Starter
    Registered User
    Join Date
    Apr 2006
    Posts
    6

    Working with WMI from vb6

    I was the one who asked some days ago about determining hardware in my PC using vb6.
    Now i'm trying to do that using WMI but something isn't working...
    in the projects MS WMI Scripting V1.1 Library reference was added.
    There is a combobox to retrieves the results.
    But the problem is that just a few characteristic are retrieve as the following:
    Caption: Placa Base
    CreationClassName: Win32_BaseBoard
    Description:Placa Base
    HostingBoard: Verdadero
    Name:PlacaBase
    PoweredOn: Verdadero
    Tag:BaseBoard

    Don't retrives the others characteristic.

    What's wrong with this?
    Please can somebody guide me?, i'm really a beginner

    Thanks

    the code is as follow:

    Private Sub Command1_Click()
    On Error Resume Next
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard", , 48)
    With Combo1
    For Each objItem In colItems
    .AddItem "Caption: " & objItem.Caption
    .AddItem "ConfigOptions: " & objItem.ConfigOptions
    .AddItem "CreationClassName: " & objItem.CreationClassName
    .AddItem "Depth: " & objItem.Depth
    .AddItem "Description: " & objItem.Description
    .AddItem "Height: " & objItem.Height
    .AddItem "HostingBoard: " & objItem.HostingBoard
    .AddItem "HotSwappable: " & objItem.HotSwappable
    .AddItem "InstallDate: " & objItem.InstallDate
    .AddItem "Manufacturer: " & objItem.Manufacturer
    .AddItem "Model: " & objItem.Model
    .AddItem "Name: " & objItem.Name
    .AddItem "OtherIdentifyingInfo: " & objItem.OtherIdentifyingInfo
    .AddItem "PartNumber: " & objItem.PartNumber
    .AddItem "PoweredOn: " & objItem.PoweredOn
    .AddItem "Product: " & objItem.Product
    .AddItem "Removable: " & objItem.Removable
    .AddItem "Replaceable: " & objItem.Replaceable
    .AddItem "RequirementsDescription: " & objItem.RequirementsDescription
    .AddItem "RequiresDaughterBoard: " & objItem.RequiresDaughterBoard
    .AddItem "SerialNumber: " & objItem.SerialNumber
    .AddItem "SKU: " & objItem.SKU
    .AddItem "SlotLayout: " & objItem.SlotLayout
    .AddItem "SpecialRequirements: " & objItem.SpecialRequirements
    .AddItem "Status: " & objItem.Status
    .AddItem "Tag: " & objItem.Tag
    .AddItem "Version: " & objItem.Version
    .AddItem "Weight: " & objItem.Weight
    .AddItem "Width: " & objItem.Width
    Next
    End With

    End Sub

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Working with WMI from vb6

    Download Scriptomatic V2 from MS, its free, and it will generate the wmi code for you in vb script. Then its so easy to convert to vb.

    Not all properties are filled in by the hardware manufacturer. So some if not most will be blank. usually the important ones will be populated.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width