globalmemorystatusu.pas
来自「Delphi Win32核心API参考光盘源码 本书包含了常用的Windows」· PAS 代码 · 共 68 行
PAS
68 行
unit GlobalMemoryStatusU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TGlobalMemoryStatusForm = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
ButtonGlobalMemoryStatus: TButton;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
procedure ButtonGlobalMemoryStatusClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
GlobalMemoryStatusForm: TGlobalMemoryStatusForm;
implementation
{$R *.DFM}
procedure TGlobalMemoryStatusForm.ButtonGlobalMemoryStatusClick(
Sender: TObject);
var
GlobalMemoryInfo : TMemoryStatus; // holds the global memory status information
begin
{set the size of the structure before the call.}
GlobalMemoryInfo.dwLength := SizeOf(GlobalMemoryInfo);
{retrieve the global memory status...}
GlobalMemoryStatus(GlobalMemoryInfo);
{and display the information}
Label1.caption := 'Results of GlobalMemoryStatus:';
Label2.caption := 'Record structure size: '+IntToStr(
GlobalMemoryInfo.dwLength)+' bytes';
Label3.caption := 'Current memory load: '+IntToStr(
GlobalMemoryInfo.dwMemoryLoad)+'%';
Label4.caption := 'Total physical memory: '+Format('%.0n',[
GlobalMemoryInfo.dwTotalPhys/1])+' bytes';
Label5.caption := 'Total available physical memory: '+Format('%.0n',[
GlobalMemoryInfo.dwAvailPhys/1])+' bytes';
Label6.caption := 'Total paging file size: '+Format('%.0n',[
GlobalMemoryInfo.dwTotalPageFile/1])+' bytes';
Label7.Caption := 'Total available paging file memory: '+Format('%.0n',[
GlobalMemoryInfo.dwAvailPageFile/1])+' bytes';
Label8.caption := 'Total virtual memory: '+Format('%.0n',[
GlobalMemoryInfo.dwTotalVirtual/1])+' bytes';
Label9.caption := 'Total available virtual memory: '+Format('%.0n',[
GlobalMemoryInfo.dwAvailVirtual/1])+' bytes';
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?