Original Post
I'm working on a Windows wrapper class, and I have almost everything in it working (I think), but I also have a major problem: when building the class (before calling RegisterClass), I can't seem to get it to set lpfnWndProc to my WndProc. The essential parts: (Never used the tags before, so I hope they work - a 'Preview' option would be nice...) I've tried all manner of solutions, but I apparently haven't tried the right one yet. Any tips?
LRESULT CWindow::WindowProc(UINT Msg, WPARAM wParam, LPARAM lParam)
{
// Function body
}
bool CWindow::BuildWindow()
{ WNDCLASSEX WndCls;
WndCls.cbSize = sizeof(WndCls);
WndCls.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
WndCls.lpfnWndProc = CWindow::WindowProc; // This is causing the problem.
WndCls.cbClsExtra = 0;
WndCls.cbWndExtra = 0;
WndCls.hInstance = CWindow::m_hInstance;
WndCls.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndCls.hCursor = LoadCursor(NULL, IDC_ARROW);
WndCls.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
WndCls.lpszMenuName = NULL;
WndCls.lpszClassName = "MainWindowClass";
WndCls.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
}