I just got a bug report for an issue that only occurs when the program is running "on a 64-bit machine." Now, Delphi doesn't produce 64-bit code, so theoretically that shouldn't matter, but apparently it does in this case. I think I have a workaround, but it will break things on 32-bit Windows, so I need some way to tell:
Does anyone know how I can get those answers from within my app?
Mason, you can use IsWow64Process (WOW64 is the x86 emulator that allows 32-bit Windows-based applications to run seamlessly on 64-bit Windows)
Uses Windows;
type
WinIsWow64 = function( Handle: THandle; var Iret: BOOL ): Windows.BOOL; stdcall;
function IAmIn64Bits: Boolean;
var
HandleTo64BitsProcess: WinIsWow64;
Iret : Windows.BOOL;
begin
Result := False;
HandleTo64BitsProcess := GetProcAddress(GetModuleHandle('kernel32.dll'), 'IsWow64Process');
if Assigned(HandleTo64BitsProcess) then
begin
if not HandleTo64BitsProcess(GetCurrentProcess, Iret) then
Raise Exception.Create('Invalid handle');
Result := Iret;
end;
end;
Bye.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With