//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.