P
PLWang
Unregistered / Unconfirmed
GUEST, unregistred user!
在soureforge上下到一段代码 似乎是用CB写的 但是作者注释里说可以在Delphi里直接用
该怎么用呢
/* ...routines for Delphi and C++ BuilderUSAGE:
1. Include this unit into project.
2. Call GetCPUCount to obtain the numbr of processors in the system
......
Example:
procedure TTestForm.TimerTimer(Sender: TObject);
var i: Integer;
begin
CollectCPUData; // Get the data for all processors
for i:=0 to GetCPUCount-1 do // Show data for each processor
MInfo.Lines:=Format('CPU #%d - %5.2f%%',[i,GetCPUUsage(i)*100]);
end;
interface
*/
//uses Windows, SysUtils;
#include <windows.h>
#include "TcpuUsage.h" ......
上面CollectCPUData GetCPUCount GetCPUUsage都是该cpp单元里提供的函数
该怎么用呢
/* ...routines for Delphi and C++ BuilderUSAGE:
1. Include this unit into project.
2. Call GetCPUCount to obtain the numbr of processors in the system
......
Example:
procedure TTestForm.TimerTimer(Sender: TObject);
var i: Integer;
begin
CollectCPUData; // Get the data for all processors
for i:=0 to GetCPUCount-1 do // Show data for each processor
MInfo.Lines:=Format('CPU #%d - %5.2f%%',[i,GetCPUUsage(i)*100]);
end;
interface
*/
//uses Windows, SysUtils;
#include <windows.h>
#include "TcpuUsage.h" ......
上面CollectCPUData GetCPUCount GetCPUUsage都是该cpp单元里提供的函数