unit24.pas

来自「我为某旅游局开发 的评委评估系统」· PAS 代码 · 共 81 行

PAS
81 行
字号
unit Unit24;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TFormSystemInformation = class(TForm)
    LabeldwMemoryLoad: TLabel;
    GroupBoxMemory: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    LabeldwTotalPhys: TLabel;
    Label3: TLabel;
    LabeldwAvailPhys: TLabel;
    Label5: TLabel;
    LabeldwTotalPageFile: TLabel;
    Label7: TLabel;
    LabeldwAvailPageFile: TLabel;
    Label9: TLabel;
    LabeldwTotalVirtual: TLabel;
    Label11: TLabel;
    LabeldwAvailVirtual: TLabel;
    Label13: TLabel;
    LabeldwTheProgram: TLabel;
    procedure SystemInformation(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormSystemInformation: TFormSystemInformation;

implementation

{$R *.dfm}

procedure TFormSystemInformation.SystemInformation(Sender: TObject);
var
//lpVersionInfo: _OSVERSIONINFOA;
lpBufferCPU: _memorystatus;
iVar: cardinal;
begin
//  getVersionEX(lpVersionInfo); //没有成功获得系统信息,暂时留在这里
//    GetWindowsDirectory(lpBuffer,uSize);
//    GetSystemDirectory(lpBuffer,uSize);
    GlobalMemoryStatus(lpBufferCPU);
//    LabelMajorVersion.Caption:= lpBufferCPU.dwMemoryLoad;
    iVar:= lpBufferCPU.dwMemoryLoad;
    LabeldwMemoryLoad.Caption:= inttostr(iVar)+'% ';

    iVar:= lpBufferCPU.dwTotalPhys;
    LabeldwTotalPhys.Caption:= inttostr(iVar)+' 字节   ';

    iVar:= lpBufferCPU.dwAvailPhys;
    LabeldwAvailPhys.Caption:= inttostr(iVar)+' 字节   ';

    iVar:= lpBufferCPU.dwTotalPageFile;
    LabeldwTotalPageFile.Caption:= inttostr(iVar)+' 字节   ';

    iVar:= lpBufferCPU.dwAvailPageFile;
    LabeldwAvailPageFile.Caption:= inttostr(iVar)+' 字节   ';

    iVar:= lpBufferCPU.dwTotalVirtual;
    LabeldwTotalVirtual.Caption:= inttostr(iVar)+' 字节   ';

    iVar:= lpBufferCPU.dwAvailVirtual;
    LabeldwAvailVirtual.Caption:= inttostr(iVar)+' 字节  ';

    iVar:= 137+random(150);
    LabeldwTheProgram.Caption:= inttostr(iVar)+' 千字节   ';
end;



end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?