function FuncAvail(Lib, Func: string; var hnd: THandle; var ptr: Pointer): boolean;
begin
Result := false;
hnd := 0;
if LoadLibrary(PChar(Lib)) = 0 then
begin
Exit;
end;
hnd := GetModuleHandle(PChar(Lib));
if (hnd <> 0) then
begin
ptr := GetProcAddress(hnd, PChar(Func));
if (ptr <> nil) then
begin
Result := true;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
hnd: THandle;
xBlockInput: function(Block: BOOL): BOOL; stdcall;
begin
if FuncAvail('USER32.DLL', 'BlockInput', hnd, @xBlockInput) then
begin
xBlockInput(true);
Sleep(15000); // 15秒
xBlockInput(false);
FreeLibrary(hnd);
end;
end;
コメント (0件)