Class problems
Im trying to create a DirectX Window class that has virtual functions so the deriving class can override them.
Anyway, Im trying to create the windows, but I get this error
error C2440: ''='' : cannot convert from ''LRESULT (__stdcall CDXWindow::* )(HWND,UINT,WPARAM,LPARAM)'' to ''WNDPROC''
The line is this piece of code
win.lpfnWndProc = GameProc;
GameProc is defined as
virtual LRESULT CALLBACK GameProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
Typecasting didn''t work of course. Any suggestions?
How did you typecast?
I use
win.lpfnWndProc = (WNDPROC)GameProc;
and it works fine.
I use
win.lpfnWndProc = (WNDPROC)GameProc;
and it works fine.
quote:
virtual LRESULT CALLBACK GameProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
Given the keyword virtual in there, you have made GameProc part of your CDXWindow class I assume?
There are two ways to fix your problem:
1. Make your GameProc function static within the class. Beware the problems this will cause if you want to create more than one window (ie, they will all share the exact same GameProc function).
2. Move GameProc out of the class.
Alan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement