this slowpoke moves

Ermittle ob Windows 64bit oder 32 bit ist

function IsWindows64: Boolean;
type
  TIsWow64Process = function( // Type of IsWow64Process API fn
    Handle: Windows.THandle; var Res: Windows.BOOL
  ): Windows.BOOL; stdcall;
var
  IsWow64Result: Windows.BOOL; // Result from IsWow64Process
  IsWow64Process: TIsWow64Process; // IsWow64Process fn reference
begin
  IsWow64Process := Windows.GetProcAddress(
    Windows.GetModuleHandle('kernel32'), 'IsWow64Process'
  );
  if Assigned(IsWow64Process) then
  begin
    if not IsWow64Process(
      Windows.GetCurrentProcess, IsWow64Result
    ) then
      raise SysUtils.Exception.Create('IsWindows64: bad process handle');
    Result := IsWow64Result;
  end
  else
    Result := False;
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
begin
  if IsWindows64 = true then
  ShowMessage('Windows 64 bit')
  else
  ShowMessage('Windows 32 bit');
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate