>This is good but how do I get the cpu usage value?
Ah, I thought you wanted to know the process that were running. Wait me a second.
[Update]
Oops! Doh, now I understand the question, you want the CPU usage for each of the processes... I need to think that one
[Update 2]
Well, I can not continue looking for this, it seems as if I can get the Percentaje of CPU at a given time but not the actual value, I think you should use the Performance classes of WMI for this, but I never used them other that to see them, never looked into them, see if this helps
lparameters tcComputer, tcProcess
local lcComputer, loWMI, loProcess, loProcesses, lcProcess
lcComputer = Iif(Vartype(tcComputer) = 'C' and not Empty(tcComputer), tcComputer, '.')
lcProcess = Iif(Vartype(tcProcess) = 'C', tcProcess, '')
loLocator = CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI = loLocator.ConnectServer(lcComputer)
loPerfDataCol = loWMI.ExecQuery('Select * from Win32_PerfFormattedData_PerfProc_Process')
for each loPerfData in loPerfDataCol
with loPerfData
? .Caption, .CreatingProcessID, .Description, .PercentProcessorTime, .ElapsedTime, .Name
endwith
endfor
To see more properties for this class go to
http://msdn2.microsoft.com/en-us/library/aa394277.aspxAlso take a look at all the Win32_PerfFormatted* and Win32_PerfRaw* classes, you might find there what you need, it might even be that I am completely off mark
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges