本文整理自网络,侵删。
//DLL代码如下:
library MouseHOOK;
uses
Windows, Messages;
var
hNextHookProc: HHook;
function MouseHookProc(iCode: Integer;wParam: WPARAM;lParam: LPARAM): LRESULT; stdcall; export;
begin
If iCode < 0 Then
begin
if wParam = WM_LBUTTONDOWN then
begin
Result := CallNextHookEx(hNextHookProc, iCode, wParam, lParam);
end
else
Result:=1;
end;
end;
function DisableMouse: BOOL; export;
begin
Result := False;
if hNextHookProc <> 0 then Exit;
hNextHookProc := SetWindowsHookEx(WH_MOUSE,MouseHookProc,HInstance,0);
Result:=False;
end;
function EnableMouse: BOOL; export;
begin
if hNextHookProc <> 0 then
begin
UnhookWindowshookEx(hNextHookProc);
hNextHookProc := 0;
end;
Result := hNextHookProc = 0;
end;
exports
EnableMouse,
DisableMouse;
end.
相关阅读 >>
Delphi2010中字符串汇编需要注意的一点,以及支持2010的aes加密库
Delphi 2009 泛型容器单元(generics.collections)[5]: tobject...<t> 系列
Delphi winapi: getwindowtext - 获取窗口标题
Delphi winapi: getnextwindow - 获取指定窗口z上或z下的窗口的句柄
更多相关阅读请进入《Delphi》频道 >>