Einzelnen Beitrag anzeigen

HolgerX

Registriert seit: 10. Apr 2006
Ort: Leverkusen
961 Beiträge
 
Delphi 6 Professional
 
#16

AW: läuft Programm unter 32-Bit oder 64-Bit ab ?

  Alt 10. Jun 2017, 15:08
Hmm..

Da IsWow64Process erst ab einem späteren Delphi verfügbar ist, nutze ich folgende Funktion, um festzustellen, ob meine App in einer 64Bit-Umgebung läuft.. (Benutze halt noch D6 Prof und werde NICHT zur Starter wechseln !) )

(Keine Ahnung mehr, wo ich den herhabe.. )

Delphi-Quellcode:
function IsWow64A: 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
  // Try to load required function from kernel32
  IsWow64Process := Windows.GetProcAddress(Windows.GetModuleHandle('kernel32'), 'IsWow64Process');

  if Assigned(IsWow64Process) then begin
    // Function is implemented: call it
    if not IsWow64Process(Windows.GetCurrentProcess, IsWow64Result) then
      raise Exception.Create('IsWow64: bad process handle');

    Result := IsWow64Result; // Return result of function
  end else
    // Function not implemented: can't be running on Wow64
    Result := False;
end;
  Mit Zitat antworten Zitat