type
TMemoryStatusEx = packed record
cLength: Cardinal;
cMemoryLoad: Cardinal;
i64TotalPhys: Int64;
i64AvailPhys: Int64;
i64TotalPageFile: Int64;
i64AvailPageFile: Int64;
i64TotalVirtual: Int64;
i64AvailVirtual: Int64;
i64AvailExtendedVirtual: Int64;
end;
function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): BOOL;
stdcall; external kernel32;
// Beispielaufruf
procedure TForm1.Button11Click(Sender: TObject);
var
Status: TMemoryStatusEx;
begin
status.clength := sizeof(status);
GlobalMemoryStatusEx(status);
label2.caption := 'Speicher insgesamt: ' +
formatfloat('#,##0.0', status.i64TotalPhys / 1048576) + ' MB' + #13 +
'zur Zeit in Benutzung: ' + inttostr(status.cMemoryLoad) + ' %' + #13 +
'noch frei: ' + formatfloat('#,##0.0', status.i64AvailPhys / 1048576) + ' MB';
end;