Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Registry;
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Button2: TButton;
- Label1: TLabel;
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- TOSInfo = class(TObject)
- public
- class function IsWOW64: Boolean;
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- class function TOSInfo.IsWOW64: Boolean;
- type
- TIsWow64Process = function(
- Handle: THandle;
- var Res: BOOL
- ): BOOL; stdcall;
- 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 TForm1.FormCreate(Sender: TObject);
- begin
- if TOSInfo.IsWOW64 = True then begin
- Label1.Caption := 'You are on a x64 machine.';
- //ShowMessage('Running on 64-bit OS!!');
- Button1.Enabled := False;
- end
- else
- begin
- Label1.Caption := 'You are not on a x64 machine.';
- //ShowMessage('NOT running on 64-bit OS!!');
- Button2.Enabled := False;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement