Mega Code Archive

 
Categories / Delphi / Hardware
 

How to get total physical memory (for beginners)

Title: How to get total physical memory? (for beginners) Question: How I can get total system physical memory? Answer: // returns total of physical memory installed (read-up recognized) function GetMemoryTotalPhys: dword; var recMemoryStatus: TMemoryStatus; begin // sets record size recMemoryStatus.dwLength := SizeOf(TMemoryStatus); // retrieves global memory status (WinAPI) GlobalMemoryStatus(recMemoryStatus); // sets result with total amount of memory result := recMemoryStatus.dwTotalPhys; end;