Archived

This topic is now archived and is closed to further replies.

Class problems

This topic is 5428 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites