Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I determine the amount of RAM?

System Information

How do I determine the amount of RAM?

by  Stretchwickster  Posted    (Edited  )
[color red]Update: I have applied strikethrough formatting to my original code (written a number of years ago) in the code block below, so that it remains recorded.

However, please see the following very helpful and up-to-date (as at 10 Sep 2009) thread by Griffyn:
thread102-1568664
[/color]

Code:
[s]
function GetRAM: String;
var
  memory: TMemoryStatus;
  memoryAmount: Double;
begin
  memory.dwLength := SizeOf(memory);
  GlobalMemoryStatus(memory);
  { calculate RAM to the nearest MB }
  memoryAmount := RoundTo(memory.dwTotalPhys  / 1048576, -2);
  Result := FloatToStr(memoryAmount) + 'MB';
end;
[/s]

Sources:
http://www.swissdelphicenter.ch/torry/showcode.php?id=94
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top