this slowpoke moves

Determine over 2GB RAM

type
  TMemoryStatusEx = packed record
    dwLength: DWORD;
    dwMemoryLoad: DWORD;
    ullTotalPhys: Int64;
    ullAvailPhys: Int64;
    ullTotalPageFile: Int64;
    ullAvailPageFile: Int64;
    ullTotalVirtual: Int64;
    ullAvailVirtual: Int64;
    ullAvailExtendedVirtual: Int64;
end;

//

function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): BOOL; stdcall;
type
  TFNGlobalMemoryStatusEx = function(var msx: TMemoryStatusEx): BOOL; stdcall;
var
  FNGlobalMemoryStatusEx: TFNGlobalMemoryStatusEx;
begin
  FNGlobalMemoryStatusEx := TFNGlobalMemoryStatusEx(
    GetProcAddress(GetModuleHandle(kernel32), 'GlobalMemoryStatusEx'));
  if not Assigned(FNGlobalMemoryStatusEx) then
  begin
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    Result := False;
  end
  else
    Result := FNGlobalMemoryStatusEx(lpBuffer);
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
var  Status: TMemoryStatusEx;
begin
  ZeroMemory(@Status, SizeOf(TMemoryStatusEx));
  Status.dwLength := SizeOf(TMemoryStatusEx);
  GlobalMemoryStatusEx(Status);
  Label1.Caption := 'Total RAM: ' + IntToStr(Status.ullTotalPhys);
  Label2.Caption := 'Verfügbar RAM: ' + IntToStr(Status.ullAvailPhys);
  Label3.Caption := 'Total Pagefile: ' + IntToStr(Status.ullTotalPageFile);
  Label4.Caption := 'Verfügbar Pagefile: ' + IntToStr(Status.ullAvailPageFile);
  Label5.Caption := 'Total Virtuell: ' + IntToStr(Status.ullTotalVirtual);
  Label6.Caption := 'Verfügbar Virtuell: ' + IntToStr(Status.ullAvailVirtual);
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate