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.

演示图


相关阅读 >>

Delphi 加载excel 导入数据库

Delphi fdmemtable内存表操作

Delphi遍历所有控件

Delphi 让scrollbox响应鼠标的滚动消息

Delphi getsys32path()得到系统system32路径

Delphi webbrowser1实现滚屏

Delphi 高亮选中memo某一行

Delphi 三层架构简单例子(经测试成功)

Delphi 验证guid的函数

Delphi rest application 与 webbroker application 区别

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...