如何获取进程CPU使用率
如何获取进程CPU使用率 请给个算法 谢谢!
[解决办法]
http://www.freevbcode.com/ShowCode.asp?ID=8146
http://www.freevbcode.com/ShowCode.asp?ID=181
[解决办法]
Dim HQ As Long
Dim counter As Long
Dim lData As Long
Call PdhVbOpenQuery(HQ)
Call PdhVbAddCounter(HQ, "\Processor(0)\% Processor Time ", counter)
Call PdhCollectQueryData(HQ)
Call PdhVbGetDoubleCounterValue(counter, lData)
Call PdhCollectQueryData(HQ)
r = CLng(PdhVbGetDoubleCounterValue(counter, lData))
r就是CPU占用率