Mega Code Archive

 
Categories / Delphi / Forms
 

Get system memory information

Title: Get system memory information Use GlobalMemoryStatus procedure with variable of TMemoryStatus type for getting information about memory. procedure TForm1.Button1Click(Sender: TObject); var MyStatus: TMemoryStatus; begin MyStatus.dwLength:=SizeOf(MyStatus); GlobalmemoryStatus(MyStatus); with Memo1.Lines do begin Add(FloatToStr( MyStatus.dwMemoryLoad)+'% memory in use'); Add(FloatToStr( MyStatus.dwTotalPhys/1024)+' Kb of physical memory'); Add(FloatToStr( MyStatus.dwAvailPhys/1024)+ ' Kb of available physical memory'); Add(FloatToStr( MyStatus.dwTotalPageFile/1024)+ ' Kb that can be stored in the paging file'); Add(FloatToStr( MyStatus.dwAvailPageFile/1024)+ ' Kb available in the paging file'); end; end;