- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi检查是否在64位Windows环境中运行?
{$J+}
function IsWow64Process: Boolean;
type
TIsWow64Process = function(hProcess: THandle; var Wow64Process: Boolean): Boolean; stdcall;
var
DLL: THandle;
pIsWow64Process: TIsWow64Process;
const
Called: Boolean = False;
IsWow64: Boolean = False;
begin
if (Not Called) then // only check once
begin
DLL := LoadLibrary('kernel32.dll');
if (DLL <> 0) then
begin
pIsWow64Process := GetProcAddress(DLL, 'IsWow64Process');
if (Assigned(pIsWow64Process)) then
begin
pIsWow64Process(GetCurrentProcess, IsWow64);
end;
Called := True; // avoid unnecessary loadlibrary
FreeLibrary(DLL);
end;
end;
Result := IsWow64;
end;
{$J-}