【发布时间】:2011-02-20 11:33:36
【问题描述】:
我正在创建一个自定义控件类,因为我想要完全控制它,所以我注册了该类并希望使用该类的
LRESULT 回调 OGLTOOLBAR::ToolProc(HWND, UINT, WPARAM, LPARAM)
但它不让我。
我在做:
HWND OGLTOOLBAR::create(HWND parent,HINSTANCE hInst, int *toolWidthPtr)
{
if (toolhWnd != NULL)
{
return toolhWnd;
}
toolWidth = toolWidthPtr;
ZeroMemory(&rwc,sizeof(rwc));
rwc.lpszClassName = TEXT("OGLTool");
rwc.hbrBackground = GetSysColorBrush(COLOR_BTNSHADOW);
rwc.lpfnWndProc = (WNDPROC)ToolProc;
rwc.hCursor = LoadCursor(0, IDC_ARROW);
RegisterClass(&rwc);
toolhWnd = CreateWindowEx(NULL, rwc.lpszClassName,NULL,
WS_CHILD | WS_VISIBLE,
0, 0, *toolWidth, 900, parent, 0, NULL, 0);
return toolhWnd;
}
这样做的正确方法是什么?
谢谢
编译器说: 错误 1 错误 C2440: 'type cast' : 无法从 'overloaded-function' 转换为 'WNDPROC'
【问题讨论】: