1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Type
TMEMORYSTATUSEX= Record
dwLength : DWord;
dwMemoryLoad : DWord;
ullTotalPhys : Int64;
ullAvailPhys : Int64;
ullTotalPageFile : Int64;
ullAvailPageFile : Int64;
ullTotalVirtual : Int64;
ullAvailVirtual : Int64;
ullAvailExtendedVirtual : Int64;
End;
procedure GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx); stdcall; external kernel32 name 'GlobalMemoryStatusEx';
procedure TForm1.Button1Click(Sender: TObject);
var Mem:TMEMORYSTATUSEX;
Begin
// Recherche des informations sur la mémoire
Mem.dwLength:=SizeOf(TMEMORYSTATUSEX);
GlobalMemoryStatusEx(Mem);
// Affichage des résultats
lUtilisee .Caption := IntToStr(Mem.dwMemoryLoad)+' %';
lPhysique .Caption := FloatToStrF(Mem.ullAvailPhys /1024/1024,ffFixed,5,1)
+' / '+ FloatToStrF(Mem.ullTotalPhys /1024/1024,ffFixed,5,1)+' Mo';
lPaginee .Caption := FloatToStrF(Mem.ullAvailPageFile /1024/1024,ffFixed,5,1)
+' / '+ FloatToStrF(Mem.ullTotalPageFile /1024/1024,ffFixed,5,1)+' Mo';
lVirtuelle.Caption := FloatToStrF(Mem.ullAvailVirtual /1024/1024,ffFixed,5,1)
+' / '+ FloatToStrF(Mem.ullTotalVirtual /1024/1024,ffFixed,5,1)+' Mo';
end; |
Partager