// code ist aus flocke's sizegrip unit ausgeliehen, thx nochma :P
type
TWndProc =
function (hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT;
stdcall;
var
OldWndProc: TWndProc;
function NewWndProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT;
stdcall;
function CallOld: LRESULT;
begin
Result := CallWindowProc(@OldWndProc, hWnd, Msg, wParam, lParam);
end;
begin
// Result := DefWindowProc(hWnd, Msg, wParam, lParam); // standardWndProc aufrufen
case Msg
of
WM_DESTROY:
begin
SetWindowLong(hWnd, GWL_WNDPROC, LongInt(@OldWndProc));
result := callold;
end;
WM_PAINT:
Begin
// dein code ^.^
end;
else
Result := CallOld;
end;
end;
procedure RemoveMsgHook(hWnd: HWND);
begin
if @OldWndProc <>
nil then
SetWindowLong(hWnd, GWL_WNDPROC, LongInt(@OldWndProc));
end;
procedure SetMsgHook(hWnd: HWND);
begin
RemoveMsgHook(hWnd);
OldWndProc := TWndProc(Pointer(GetWindowLong(hWnd, GWL_WNDPROC)));
SetWindowLong(hWnd, GWL_WNDPROC, LongInt(@NewWndProc));
end;