delphi 获取CPU Monitor使用率  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi 获取CPU Monitor使用率


unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils,System.StrUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
    Times: TThread.TSystemTimes;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.FormCreate(Sender: TObject);
begin
TThread.GetSystemTimes(Times);
  end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  Usage: Integer;
begin
  Usage := TThread.GetCPUUsage(Times);
  form1.Caption := IntToStr(Usage) + '%';
end;

end.

演示图



推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.058274030685425 seconds