开发者

Subclassing a control

开发者 https://www.devze.com 2023-01-23 00:52 出处:网络
Ok so i\'m trying to subclass a ListView control. I\'m using SetWindowLong(). Consider this code: WNDPROC oldProc;

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.
}
0

精彩评论

暂无评论...
验证码 换一张
取 消