Subclassing a control
Ok so i'm trying to subclass a ListView control. I'm using SetWindowLong(). Consider this code:
WNDPROC oldProc;
WNDPROC newProc(hwnd, msg, wparam, lparam) // not proper code, but you get the idea { // some code here }
MainProc(...) { oldProc = SetWindowLong(control_hwnd, GWL_WNDPROC, (LONG) &newproc); }
At the setwindowlong f开发者_运维技巧unction call, i'm getting a compiler error. error: address of overloaded function with no contextual type information
Yet as MSDN, their example is pretty much the same. What's wrong with my code?
It looks like the definition of newProc
is incorrect. It should be:
LRESULT CALLBACK newProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
// Some code here.
}
精彩评论