来来来,看看我的HOOK,怎么什么都HOOK不到啊?
下面是主要代码,
我已经放到dll里了里面的名字可能有点怪(因为,该代码是改自一个MOUSE hook的)function MyMouseProc(nCode : integer; wParam : WPARAM; lParam : LPARAM) : LRESULT; stdcall;
var
MyMsg : ^Msg;
begin
if (nCode >= 0) then
begin
MyMsg:=Pointer(lParam);
if MyMsg^.message = WM_GetText then
begin
if MyMsg^.lParam <> 0 then
begin
showmessage(string(MyMsg^.lParam));
// ShowMessage(IntToStr(x) + ', ' + IntToStr(y) + #13#10 + GetText(MyMouseHookStruct^.hwnd));
// ShowMessage(IntToStr(x) + ', ' + IntToStr(y) + #13#10 + p);
end;
end;
end;Result := CallNextHookEx(WH_GETMESSAGE, nCode, wParam, lParam);
end; function InstallMouseHook : boolean;
begin
Result := False;
if (hMouseHook <> 0) then Exit;
hMouseHook := SetWindowsHookEx(WH_GETMESSAGE, MyMouseProc, HInstance, 0);
Result := (hMouseHook <> 0);
end; function UninstallMouseHook : boolean;
begin
if (hMouseHook <> 0) then
begin
UnhookWindowsHookEx(hMouseHook);
hMouseHook := 0;
MessageBeep(0); MessageBeep(0); MessageBeep(0);
end; Result := (hMouseHook = 0);
end;
下面是主要代码,
我已经放到dll里了里面的名字可能有点怪(因为,该代码是改自一个MOUSE hook的)function MyMouseProc(nCode : integer; wParam : WPARAM; lParam : LPARAM) : LRESULT; stdcall;
var
MyMsg : ^Msg;
begin
if (nCode >= 0) then
begin
MyMsg:=Pointer(lParam);
if MyMsg^.message = WM_GetText then
begin
if MyMsg^.lParam <> 0 then
begin
showmessage(string(MyMsg^.lParam));
// ShowMessage(IntToStr(x) + ', ' + IntToStr(y) + #13#10 + GetText(MyMouseHookStruct^.hwnd));
// ShowMessage(IntToStr(x) + ', ' + IntToStr(y) + #13#10 + p);
end;
end;
end;Result := CallNextHookEx(WH_GETMESSAGE, nCode, wParam, lParam);
end; function InstallMouseHook : boolean;
begin
Result := False;
if (hMouseHook <> 0) then Exit;
hMouseHook := SetWindowsHookEx(WH_GETMESSAGE, MyMouseProc, HInstance, 0);
Result := (hMouseHook <> 0);
end; function UninstallMouseHook : boolean;
begin
if (hMouseHook <> 0) then
begin
UnhookWindowsHookEx(hMouseHook);
hMouseHook := 0;
MessageBeep(0); MessageBeep(0); MessageBeep(0);
end; Result := (hMouseHook = 0);
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货