I have been running this code on both an XP pro and 2003 server. Both
machines are giving me a zero cpu usage value for every process.
.
I haven't been getting the overflow error though.
Thanks.
>>This is perfect, Ed. Exactly what I was looking for. Thank you very
>>much.-John
[quoted text clipped - 9 lines]
> hth,
> Ed
OK, i got it. I had to download the entire project from the site you
recommended Ed.
.
The trick is keeping the cpuprocess class in memory for each process you
want to track. You do the initialize of the class, pass it a processid, but
do not destroy the object. When you want the CPU % value, just ask for it
using the proper instantiated class for the unique PID.
.
Works great. Thanks again.
>I have been running this code on both an XP pro and 2003 server. Both
>machines are giving me a zero cpu usage value for every process.
[quoted text clipped - 15 lines]
>> hth,
>> Ed
Ed - 23 Aug 2007 08:41 GMT
>OK, i got it. I had to download the entire project from the site you
>recommended Ed.
[quoted text clipped - 5 lines]
>.
>Works great. Thanks again.
Ya it seems to work really well with my dual core unlike most routines
I've tried. Here's sort of the way I use it for a list of running
programs,...
'Gen. Declare
Dim CpuUseList(100) As ClsProcCpuUsage ' 100 files max for testing
'Form Load
For I = 1 To 100
Set CpuUseList(I) = New ClsProcCpuUsage
Next I
' Sub Get PIDs
' PID = .ProcessID
If i < 101 Then
CpuUseList(i).pid = PID
Cpu_Usage_For_This_PID = Format(CpuUseList(i).GetCpuUsage, "##0.00")
End If
' my update for the CLASS
Public Property Let pid(ByVal ID As Long)
'only initialize if new PID
If ProcessID = ID Then Exit Property
ProcessID = ID
InitialiseCounter
End Property
' Unload/Kill
For i = 1 To 100
Set CpuUseList(i) = Nothing
Next i
Erase CpuUseList()
Cheers,
Ed