Archived

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

Maega

Class problems

Recommended Posts

Maega    707
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
Alan Kemp    772
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