1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49:
| function GlobalKeyboardHook(code: integer; wParam: word; lParam: longword): longword; stdcall; begin if code < 0 then begin GlobalKeyboardHook := CallNextHookEx(CurrentKeyboardHook, code, wParam, lParam); exit; end;
if ((wParam=VK_CONTROL) and ((lParam and $8100FFFF)=$80000001)) then Mouse_mode := not Mouse_mode; if Mouse_mode then begin if(((lParam and $8000FFFF) = $80000001) and (wParam <> VK_CONTROL)) then begin sysutils.beep; mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); end; GlobalKeyboardHook := 1; end else GlobalKeyboardHook := 0;
CallNextHookEx(CurrentKeyboardHook, code, wParam, lParam); end;
function GlobalMouseHook(code: integer; wParam: word; lParam: longword): longword; stdcall; begin if code < 0 then begin GlobalMouseHook := CallNextHookEx(CurrentMouseHook, code, wParam, lParam); exit; end;
if Mouse_mode then begin GlobalMouseHook:=0 end else begin Windows.SetCursorPos(100, 230); GlobalMouseHook:=1; end;
CallNextHookEx(CurrentMouseHook, code, wParam, lParam); GlobalMouseHook:=0; end; |