I'm working in an IDE which creates a hwnd
and its respective WndProc
LRESULT CALLBACK
. I need to change the WndProc
to a custom one.
I've read that SetWindowLong
would do the job, but I can't find any working example. For example:
HWND hwnd; //My window
SetWindowLong(hwnd, GWL_WNDPROC, myNewWndProc);
The third parameter for SetWindowLong
is a Long
as the name of the function names it. How can I make a reference from my WndProc
function to a Long
?
My WndProc
:
LRESULT CALLBACK WndProcedure(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
msg_dev(toString(uMsg));
switch(uMsg){
case WM_MOUSEMOVE:
SetCursor(LoadCursor(NULL, IDC_HAND));
break;
case WM_LBUTTONDOWN:
msg_dev("Button down!");
break;
default:
DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
};
SetWindowSubclass
for this. – Ridotto