An example ...... i can show you how to do it
(As I have no Delphi installed I dunno if it compiles ...)
First, you need a variable that holds the old WndProc. A Pointer should do the job.
To get the pointer to the WndProc you can call GetWindowLong(), to process the messages in your program, you need a seperate function
Delphi-Quellcode:
var
OldWndProc: Pointer;
begin // Change WndProc
OldWndProc := GetWindowLong(
{Handle to the Button}, GWLP_WNDPROC);
SetWindowLong(
{Handle to the Button}, GWLP_WNDPROC, @NewWndProc);
end;
function NewWndProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT;
begin
if (
{The Message you want})
// Handle Message
else // Call old WndProc
CallWindowProc(OldWndProc, hWnd, uMsg, wParam, lParam);
end;
Something like that
To get the
Handle of the button, you can use FindWindow.
You can find additional stuff by searching for "subclassing"