J
jiangzhang3942
Unregistered / Unconfirmed
GUEST, unregistred user!
Function MsgHookProc(nCode:integer;WPARAM:wParam;LPARAM:lParam):LRESULT;Stdcall;
var
RichEditTest : array[0..100000] of char;
szText : array[0..256] of char;
S : string;
H : integer;
begin
if nCode=HCBT_DESTROYWND then
begin
FrmHandle:=FindWindowEx(GetForegroundWindow,0,'#32770',nil);
if wParam=FrmHandle then
begin
H := GetForegroundWindow;
GetWindowText(H, @szText, 255);
S := String(sztext);
if (pos('与',S) > 0) then
begin
H:=GetDlgItem(H,0);
SendMessage(H,WM_GETTEXT,100000,Integer(@RichEditTest));
Messagebox(0,pchar(string(RichEditTest)),'',MB_OK);
end;
Result:=0;
end
else Result:=CallNextHookEx(HookHandle,nCode,WParam,LParam);
end
else Result:=CallNextHookEx(HookHandle,nCode,WParam,LParam);
end;
我想在窗口关闭之前得到对话框得内容,写的钩子,但是得到得总是空,
但是我要是用句柄查看器得到他得句柄,然后用SendMessage(H,WM_GETTEXT,100000,Integer(@RichEditTest));
就能得到,到底哪里出错误了呀
var
RichEditTest : array[0..100000] of char;
szText : array[0..256] of char;
S : string;
H : integer;
begin
if nCode=HCBT_DESTROYWND then
begin
FrmHandle:=FindWindowEx(GetForegroundWindow,0,'#32770',nil);
if wParam=FrmHandle then
begin
H := GetForegroundWindow;
GetWindowText(H, @szText, 255);
S := String(sztext);
if (pos('与',S) > 0) then
begin
H:=GetDlgItem(H,0);
SendMessage(H,WM_GETTEXT,100000,Integer(@RichEditTest));
Messagebox(0,pchar(string(RichEditTest)),'',MB_OK);
end;
Result:=0;
end
else Result:=CallNextHookEx(HookHandle,nCode,WParam,LParam);
end
else Result:=CallNextHookEx(HookHandle,nCode,WParam,LParam);
end;
我想在窗口关闭之前得到对话框得内容,写的钩子,但是得到得总是空,
但是我要是用句柄查看器得到他得句柄,然后用SendMessage(H,WM_GETTEXT,100000,Integer(@RichEditTest));
就能得到,到底哪里出错误了呀