Original Post
I have a class named OpenGLMgr, and it has a member WndProc that I want to use as a window handler. However, when I try to put the pointer to the function in WNDCLASS, it gives me a type-conversion error. Here''s the code:
class OpenGLMgr
{
// Other stuff in here ...
protected:
// Internal Functions
void oglmCreateWindow(void);
LRESULT CALLBACK oglmWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
};
void OpenGLMgr::oglmCreateWindow(void)
{
// Other stuff...
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC)(this->oglmWndProc);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = m_hInstance;
}
C:\GLTest\OpenGLMgr.cpp(81) : error C2440: ''type cast'' : cannot convert from '''' to ''long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)''