タイトル通りなのですか、利用パソコンが32ビットOSか、64ビットOSか判定する関数を探しています。
OSVERSIONINFO で取れるかと思いましたが、うまくいきませんでした。
x86 or x64 か調べる事はできるのでしょうか
つIsWow64Process
ぽむぽむさん、こんにちは。ヒントありがとうございます。
IsWow64Processを使って解決する事ができました。
サンプルソースです。
type
TIsWow64Process = function(
Handle: THandle;
var Res: BOOL
): BOOL; stdcall;
function IsWOW64: Boolean;
var
IsWow64Result: BOOL;
IsWow64Process: TIsWow64Process;
begin
IsWow64Process := GetProcAddress(
GetModuleHandle('kernel32'), 'IsWow64Process'
);
if Assigned(IsWow64Process) then
begin
if not IsWow64Process(GetCurrentProcess, IsWow64Result) then
raise Exception.Create('Bad process handle');
Result := IsWow64Result;
end
else
Result := False;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
if IsWOW64 = True then
ShowMessage('Running on 64-bit OS!!')
else
ShowMessage('NOT running on 64-bit OS!!');
end;
ツイート | ![]() |