API - descobrir memoria livre e ocupada no WinXP e Win98 |
Top Previous Next |
function FormatKBytes(Amount: Cardinal): string; begin Result := FormatFloat('O, KB', Amount div 1024); end;
...
if Win32Platform = VER_PLATFORM_WIN32_NT then begin PMC.cb := SizeOf(PMC); GetProcessMemoryInfo(GetCurrentProcess, @PMC, SizeOf(PMC)); txWSSize.Caption := FormatKBytes(PMC.WorkingSetSize); txVMSize.Caption := FormatKBytes(PMC.PagefileUsage); end else begin GlobalMemoryStatus(MemInfo); txWSSizeTitle.Caption := SPhysicalMemory; txVMSizeTitle.Caption := SAvailableMemory; txWSSize.Caption := FormatKBytes(MemInfo.dwTotalPhys); txVMSize.Caption := FormatKBytes(MemInfo.dwAvailPhys); end; |