This is a continuation from this question.
I have the following assignment:
WNDCLASSEX wndClass =
sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0, 0,
GetModuleHandle( NULL ), NULL, NULL, NULL, NULL,
"D3D Tutorial", NULL
wc = wndClass;
C2440: 'initializing' : cannot convert from 'overloaded-function' to
1>None of the functions with this name in scope
match the target type
LRESULT WINAPI RAT_RendererDX9::MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
switch( msg )
PostQuitMessage( 0 );
ValidateRect( hWnd, NULL );
return DefWindowProc( hWnd, msg, wParam, lParam );
LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
From your declaration of
MsgProc it seems that it's a regular member function, which means it takes a "hidden"
this pointer. That makes it incompatible with WNDPROC and that's why the compiler complains.
Trying marking it as
static. Of course, this means that you cannot access non-static members of the class easily - you will need to stash a copy of the
this pointer of the instance you want somewhere to do that.
You may also need
CALLBACK instead of
WINAPI but I don't have easy access to a compiler to verify this at this time.