Skip to main content
GameDev.net gamedev.net
🔒 Locked

Class problems

Started by Maega Jan 30, 2003 at 3:23 PM 1 replies 300+ views
Original Post
Maega
Maega
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?
Alan Kemp
Alan Kemp
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
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.