FUNCTION FunctionDetect(LibName, FuncName: STRING; VAR LibPointer: Pointer):
boolean;
VAR
LibHandle : tHandle;
BEGIN Result := false;
LibPointer := NIL;
IF LoadLibrary(PChar(LibName)) = 0 THEN
exit;
LibHandle := GetModuleHandle(PChar(LibName));
IF LibHandle <> 0 THEN
BEGIN
LibPointer := GetProcAddress(LibHandle, PChar(FuncName));
IF LibPointer <> NIL THEN
Result := true;
END;
END;
放一按钮 代码
VAR
xBlockInput : FUNCTION(Block: BOOL): BOOL; stdcall;
BEGIN
IF FunctionDetect('USER32.DLL', 'BlockInput', @xBlockInput) THEN
BEGIN xBlockInput(True); // 禁止键盘鼠标
Sleep(100000); // 等待10秒
xBlockInput(False); // 允许键盘鼠标
END;
END;
看看效果