1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
//##################################
// Ajout du Hook
mHookWndCall := SetWindowsHookEx(WH_CALLWNDPROC,@NewCallWndProc,Hinstance,GetCurrentThreadID);
//##################################
// Mon Hook
function NewCallWndProc(aCode: Integer; awParam: WPARAM; alParam: LPARAM): LRESULT; stdcall;
var
pMessage : PCWPSTRUCT;
lMsg : TMessage;
lControl : TWinControl;
lPoint : TPoint;
lRect : TRect;
begin
pMessage := PCWPSTRUCT( alParam );
//// -------------------------------
lMsg.Msg := pMessage^.message;
lMsg.LParam := pMessage^.lParam;
lMsg.WParam := pMessage^.wParam;
lMsg.Result := 0;
lControl := FindControl(pMessage^.hwnd);
if lControl<>nil then
Trace.WriteWndMsg(lMSg,lControl.ClassName)
else
Trace.WriteWndMsg(lMSg);
//// -------------------------------
//// ....
Result := CallNextHookEx(mHookWndCall, aCode, awParam, alParam );
end;
//##################################
// Envoi d'un message
PostMessage(Handle,WM_USER,0,0); |
Partager