Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: bryan wetton
  Where is bryan wetton?
 Morphett Vale
 Australia
 bryan wetton
 Tags
Subject: RE: WMI Obj Code
Thread ID: 231660 Message ID: 231667 # Views: 38 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Classes and Objects
Date: Tuesday, June 16, 2009 8:32:59 AM         
   


> I found these code snippets some time ago and out of interest put in one of my test programs.
>
> oWMI = Getobject("winmgmts:")
> oProcessors = oWMI.InstancesOf("WIN32_Processor")
> For Each oProcessor In oProcessors
> logging('Processor ID' +oProcessor.processorID)
> Next
>
> However it only finds 1 processor and the oWMI object is not visible in the debugger.
>
> loCIMV2 = Getobject("winmgmts://localhost/root/cimv2")
> Getobject("winmgmts://localhost/root/cimv2")
> loProcesses = loCIMV2.ExecQuery("SELECT * FROM Win32_LogicalMemoryConfiguration")
> If loProcesses.Count > 0
> For Each objProcess In loProcesses
> logging ( "Total Physical Memory, in bytes: " + Transform(objProcess.TotalPhysicalMemory))
> logging ("Total Virtual Memory, in bytes: " + Transform(objProcess.TotalVirtualMemory))
> logging ( "Available Virtual Memory, in bytes: " + Transform(objProcess.AvailableVirtualMemory))
> logging ("Total Page File Space, in bytes: " + Transform(objProcess.TotalPageFileSpace))
> Next
>
> this also does not giv an object with the appropriate information
>
> Any clues please anyone? I am using WIN 7 with AMD 64 X2 4600.
>

AMD's 64X2 as well as Intel Core2 CPUs appear as one CPU for me, but NumberOfCores is 2:

CLEAR

LOCAL strComputer, objWMIService, colItems
strComputer = "."
objWMIService = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
    ? "CurrentClockSpeed: ", NVL(objItem.CurrentClockSpeed, 'n/a')
    ? "Manufacturer: ", NVL(objItem.Manufacturer, 'n/a')
    ? "MaxClockSpeed: ", NVL(objItem.MaxClockSpeed, 'n/a')
    ? "Name: ", NVL(objItem.Name, 'n/a')
    ? "NumberOfCores: ", NVL(objItem.NumberOfCores, 'n/a')
Next




hth
-Stefan



COMPLETE THREAD
WMI Obj Code Posted by bryan wetton @ 6/16/2009 7:48:41 AM
RE: WMI Obj Code Posted by Stefan Wuebbe @ 6/16/2009 8:32:59 AM
RE: WMI Obj Code Posted by bryan wetton @ 6/16/2009 1:46:49 PM