win32 and C++ question - please...

Please help me…

Im trying to put the CALLBACK function inside a c++ class, but Im try to use:


hInstance = GetModuleHandle(NULL);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) this->WndProc;

I get this error:

error C2440: ‘=’ : cannot convert from ‘long (stdcall MyClass::*)(struct HWND *,unsigned int,unsigned int,long)’ to ‘long (stdcall *)(struct HWND *,unsigned int,unsigned int,long)’

Definitions:

class MyClass {
public:
LRESULT CALLBACK WndProc( HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
}

LRESULT CALLBACK MyClass::WndProc( HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
return 0;
}

[This message has been edited by lsdi (edited 06-23-2002).]

[This message has been edited by lsdi (edited 06-23-2002).]

this may work

make your WndProc() function static then use this:


wc.lpfnWndProc = (WndProc)MyClass::WndProc;

b

[This message has been edited by coredump (edited 06-23-2002).]

Great!!! Working now.

thanks a lot