S
sirous
Unregistered / Unconfirmed
GUEST, unregistred user!
用CreateRemoteThread成功将C.dll注入B.exe中
窗体A是B.exe的一个窗体
C.DLL在加载以后
想用setWindowsHookEx HOOK该发给窗体A的消息
假设A的caption为'111'
th:=findwindow(nil,'111');
XXX :=GetWindowThreadProcessId(th,nil);
g_hhook := setWindowsHookEx(WH_GETMESSAGE, GetMsgProc,HInstance,XXX);
执行结果显示g_hhook>0 说明HOOK成功
GetMsgProc如下: 也就是收到NEW_MSG消息弹个提示而已
function GetMsgProc(code: Integer; wparam: WPARAM; lparam: LPARAM): LRESULT; stdcall;
var
buff:TMSG;
begin
Result := 0;
buff:=PMSG(lParam)^;
if (buff.message=NEW_MSG) then
begin
showmessage('OK');
end;
if Code < 0 then
begin
result := callNexthookEx(g_hhook, code, wparam, lparam);
exit;
end;
end;
然后我在另外一个程序中执行
ty:=findwindow(nil,'111');
SendMessage(ty, NEW_MSG, 0, 0);
或
SendMessage(HWND_BROADCAST, NEW_MSG, 0, 0);
但全没有反映 没有弹出提示
怎么回事?
窗体A是B.exe的一个窗体
C.DLL在加载以后
想用setWindowsHookEx HOOK该发给窗体A的消息
假设A的caption为'111'
th:=findwindow(nil,'111');
XXX :=GetWindowThreadProcessId(th,nil);
g_hhook := setWindowsHookEx(WH_GETMESSAGE, GetMsgProc,HInstance,XXX);
执行结果显示g_hhook>0 说明HOOK成功
GetMsgProc如下: 也就是收到NEW_MSG消息弹个提示而已
function GetMsgProc(code: Integer; wparam: WPARAM; lparam: LPARAM): LRESULT; stdcall;
var
buff:TMSG;
begin
Result := 0;
buff:=PMSG(lParam)^;
if (buff.message=NEW_MSG) then
begin
showmessage('OK');
end;
if Code < 0 then
begin
result := callNexthookEx(g_hhook, code, wparam, lparam);
exit;
end;
end;
然后我在另外一个程序中执行
ty:=findwindow(nil,'111');
SendMessage(ty, NEW_MSG, 0, 0);
或
SendMessage(HWND_BROADCAST, NEW_MSG, 0, 0);
但全没有反映 没有弹出提示
怎么回事?