类Application中包含一个创建最简单窗口的成员函数,在创建函数里面先注册窗口类(WNDCLASS),其中lpfnWndProc用类的函数成员,怎么弄?class Application()
{
...
public:
LRESULT CALLBACK wndproc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
int createwnd(HINSTANCE hInstance);
...
}int Application::createwnd(HINSTANCE hInstance){
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
...
wndcls.lpfnWndProc=(WNDPROC)wndproc;
...
}编译后
error C2440: 'type cast' : cannot convert from '' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
None of the functions with this name in scope match the target type
执行 cl.exe 时出错.那位大哥帮忙?
{
...
public:
LRESULT CALLBACK wndproc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
int createwnd(HINSTANCE hInstance);
...
}int Application::createwnd(HINSTANCE hInstance){
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
...
wndcls.lpfnWndProc=(WNDPROC)wndproc;
...
}编译后
error C2440: 'type cast' : cannot convert from '' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
None of the functions with this name in scope match the target type
执行 cl.exe 时出错.那位大哥帮忙?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货