Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
Amount of installed RAM
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:
How do I get the amount of RAM installed on a system and display it in megabytes?
Answer:
You can determine this with the Win32 function GlobalMemoryStatus(). See the little function below.  | |  | | program dummy;
uses
Dialogs, Windows, SysUtils;
function DisplayRam : String;
var
Info: TMemoryStatus;
begin
Info.dwLength := sizeof(TMemoryStatus);
GlobalMemoryStatus(Info);
Result := Format('%d MB RAM', [(Info.dwTotalPhys SHR 20) + 1])
end;
begin
ShowMessage(DisplayRam)
end. | |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
|