本文整理自网络,侵删。
//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.
相关阅读 >>
Delphi 利用thttpclient实现http异步下载
Delphi int64:是Delphi中最大的整数,64位有符号整数
Delphi application.processmessage作用
更多相关阅读请进入《Delphi》频道 >>