procedure TForm1.Button2Click(Sender: TObject);<br>var<br> bAddr: DWORD;<br> SysInfo: SYSTEM_INFO;<br> MemInfo: TMemoryBasicInformation;<br> hProc: THandle;<br> mt: DWORD;<br>begin<br> mt := 0;<br> hProc := OpenProcess(PROCESS_ALL_ACCESS,False,GetCurrentProcessId);<br> GetSystemInfo(SysInfo);<br> bAddr := DWORD(SysInfo.lpMinimumApplicationAddress);<br><br> while VirtualQueryEx(hProc,Pointer(bAddr),MemInfo,SizeOf(MemInfo)) <> 0 do<br> begin<br> if (MemInfo.State = MEM_COMMIT) then<br> begin<br> mt := mt + MemInfo.RegionSize;<br> end;<br> bAddr := MemInfo.RegionSize + DWORD(MemInfo.BaseAddress);<br> end;<br> ShowMessage(IntToStr(mt div 1024));<br>end;