X
xwhjq
Unregistered / Unconfirmed
GUEST, unregistred user!
我的程序如下:var th1:thandle; function HookProc(Code: Integer; WParam: Longint; var Msg: TMsg): Longint; stdcall;
var
pt:tpoint;
s,s1,s2,s3,s4:string;
begin
Result:=0;
if Code<0 then exit;
if (Msg.Message<>WM_KEYDOWN) and (Msg.Message<>WM_KEYUP) then
begin
s3:=inttostr(Msg.Message);
message_s(Msg.Message,s1,s2);
s:=s1+' '+s2+' '+s3;
SendMessage(th1,WM_SETTEXT,0,Integer(pchar(s)));
end;
Result := CallNextHookEx(hhook, Code, WParam, Longint(@Msg));
end;
Procedure Load (TID : dWord;h:thandle); stdcall;
Begin
th1:=h; // showmessage(inttostr(th1));
if hHook=0 then hHook:=SetWindowsHookEx(WH_GETMESSAGE,@HookProc,hInstance,TID); //
end; 为何th1 在HookProc中总被置为0?
var
pt:tpoint;
s,s1,s2,s3,s4:string;
begin
Result:=0;
if Code<0 then exit;
if (Msg.Message<>WM_KEYDOWN) and (Msg.Message<>WM_KEYUP) then
begin
s3:=inttostr(Msg.Message);
message_s(Msg.Message,s1,s2);
s:=s1+' '+s2+' '+s3;
SendMessage(th1,WM_SETTEXT,0,Integer(pchar(s)));
end;
Result := CallNextHookEx(hhook, Code, WParam, Longint(@Msg));
end;
Procedure Load (TID : dWord;h:thandle); stdcall;
Begin
th1:=h; // showmessage(inttostr(th1));
if hHook=0 then hHook:=SetWindowsHookEx(WH_GETMESSAGE,@HookProc,hInstance,TID); //
end; 为何th1 在HookProc中总被置为0?