P
Poniente
I'd like to read the current CPU priority as found in the task
managers' processes tab, when right-clicking on a process, and
selecting 'set priority'.
I've tried using
Private Declare Function GetPriorityClass Lib "kernel32" (ByVal
hProcess As Long) As Long
and using
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("Select * from
Win32_Process")
For Each objProcess In colProcesses
r = r + 1
POutput(r, 1) = objProcess.ProcessID
POutput(r, 2) = objProcess.Name
POutput(r, 3) = objProcess.Priority
POutput(r, 4) = objProcess.Handle
POutput(r, 5) = GetPriorityClass(POutput(r, 4))
Next
but, but this GetPriorityClass function always returns a zero, even
though I can see some priorities are 'AboveNormal'. So this is where
I'm stuck..
Your help is appreciated.
Poniente
managers' processes tab, when right-clicking on a process, and
selecting 'set priority'.
I've tried using
Private Declare Function GetPriorityClass Lib "kernel32" (ByVal
hProcess As Long) As Long
and using
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("Select * from
Win32_Process")
For Each objProcess In colProcesses
r = r + 1
POutput(r, 1) = objProcess.ProcessID
POutput(r, 2) = objProcess.Name
POutput(r, 3) = objProcess.Priority
POutput(r, 4) = objProcess.Handle
POutput(r, 5) = GetPriorityClass(POutput(r, 4))
Next
but, but this GetPriorityClass function always returns a zero, even
though I can see some priorities are 'AboveNormal'. So this is where
I'm stuck..
Your help is appreciated.
Poniente