unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxCpu40Nv, ExtCtrls, StdCtrls, ComCtrls,cxCpu40;
type
TForm1 =
class(TForm)
ProgressBar1: TProgressBar;
ProgressBar2: TProgressBar;
ProgressBar3: TProgressBar;
ProgressBar4: TProgressBar;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Timer1: TTimer;
cxCpu402: TcxCpu40;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if cxCpu402.Available.Available=1
then begin
ProgressBar1.position:=cxCpu[1].Usage.Value.Asnumber;
//single core processors
Label1.Visible:=true;
ProgressBar1.Visible:=true;
end;
if cxCpu402.Available.Available=2
then begin
ProgressBar1.position:=cxCpu[1].Usage.Value.Asnumber;
ProgressBar2.position:=cxCpu[2].Usage.Value.Asnumber;
ProgressBar1.Visible:=true;
ProgressBar2.Visible:=true;
Label1.Visible:=true;
//dual core processors
Label2.Visible:=true;
end;
if cxCpu402.Available.Available=4
then begin
ProgressBar1.position:=cxCpu[1].Usage.Value.Asnumber;
ProgressBar2.position:=cxCpu[2].Usage.Value.Asnumber;
ProgressBar3.position:=cxCpu[3].Usage.Value.Asnumber;
ProgressBar4.position:=cxCpu[4].Usage.Value.Asnumber;
ProgressBar1.Visible:=true;
ProgressBar2.Visible:=true;
ProgressBar3.Visible:=true;
ProgressBar4.Visible:=true;
Label1.Visible:=true;
Label2.Visible:=true;
Label3.Visible:=true;
//quad core processors
Label4.Visible:=true;
end;
end;
end.