Get system info (free memory, etc)  

Send By: Q3 Team
Web :
Date: 18/07/99

Tip accessed 639 times


  • Put a TMemo (Memo1) and a TButton (Button1) in your form.
  • Put this code into OnClick of Button1:

     procedure TForm1.Button1Click(Sender: TObject);
        MemoryStatus: TMemoryStatus;
        MemoryStatus.dwLength := SizeOf(MemoryStatus);
        with MemoryStatus do
          { Size of MemoryStatus record }
          Memo1.Lines.Add(IntToStr(dwLength) +
            ' Size of ''MemoryStatus'' record');
          { Per-Cent of Memory in use by your system }
          Memo1.Lines.Add(IntToStr(dwMemoryLoad) +
            '% memory in use');
          {The amount of Total Physical memory allocated to your system.}
          Memo1.Lines.Add(IntToStr(dwTotalPhys) +
            ' Total Physical Memory in bytes');
          { The amount available of physical memory in your system. }
          Memo1.Lines.Add(IntToStr(dwAvailPhys) +
            ' Available Physical Memory in bytes');
          { The amount of Total Bytes allocated to your page file }
          Memo1.Lines.Add(IntToStr(dwTotalPageFile) +
            ' Total Bytes of Paging File');
          { The amount of available bytes in your page file }
          Memo1.Lines.Add(IntToStr(dwAvailPageFile) +
            ' Available bytes in paging file');
          { The amount of Total bytes allocated to this program
             (generally 2 gigabytes of virtual space) }
          Memo1.Lines.Add(IntToStr(dwTotalVirtual) +
            ' User Bytes of Address space');
          { The amount of avalable bytes that is left to your program to use }
          Memo1.Lines.Add(IntToStr(dwAvailVirtual) +
            ' Available User bytes of address space');