To :暗夜中独舞 老大
function HookHandler(Code : Integer;wParam : WPARAM;lParam : LPARAM): LRESULT; stdcall;
var
Msg : PMSG;
MyHandle,H : Thandle;
szText : array[0..256] of char;
S : string;
Ret : integer;
RichEditTest : array[0..100000] of char;
begin
if code=HC_ACTION then
begin
Msg := PMSG(lParam);
case Msg.message of
WM_CLOSE:
begin
MyHandle := GetForegroundWindow;
GetWindowText(MyHandle,@szText,255);
S := string(szText);
MessageBox(0,pchar(s),'',MB_OK);
if (Pos('与',S) > 0) and (Pos('聊天中',S) > 0) then
begin
H:=GetDlgItem(MyHandle,0);
messagebox(0,pchar(inttostr(h)),'',MB_OK);
H := GetDlgItem(H,$380);//聊天窗口的句柄
messagebox(0,pchar(inttostr(h)),'',MB_OK);
Ret := SendMessage(h, WM_GETTEXTLENGTH, 0, 0) + 1;
messagebox(0,pchar(inttostr(Ret)),'',MB_OK);
SendMessage(h,WM_GETTEXT,100000,Integer(@RichEditTest));
Messagebox(0,pchar(string(RichEditTest)),'',MB_OK);//这里为什么什么也没有
end;
end;
end;
end;
Result := CallNextHookEx(HookHandle, Code, wParam, lParam);
end;
截获窗体的关闭事件也不行
jiangzhang3942@163.com发给我好吗