View Single Post
Old 07-21-2005, 03:22 PM   #1 (permalink)
DIY_Gamer
Registered User
 
Join Date: Jul 2005
Posts: 2
DIY_Gamer is on a distinguished road
Question Help with C++ & Win32 in a class

Hello to all! I am a newbie to Windows programming. I have succesfully created windows in a standard .cpp file. I have even added some DX9 code. No problem...but, now I want to go modular. I have tried creatin a class which will open and maintain a window for me. I am using (*function) pointers which I can pass in to the class to be called with each msg cycle. I figured that out from the MSDN help included with VC++ 6.0 (the IDE I'm using).

My problem is actually the lpfnWndProc member of WNDCLASSEX that is giving me fits. I call my class "nuWin" and the lpfnWndProc is called "WndProc"(see below)


Code:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
. Now, in the implementation (.cpp file), it must be called nuWin::WndProc. The error I get attacks this:

Code:
C:\downloads\Learning\C++\Game Delelopment\WinCode\magWin\magWin\devWin.cpp(68) : error C2440: '=' : cannot convert from 'long (__stdcall nuWin::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,
unsigned int,long)'
I think that Win32 is having a problem making a call to a class member, even though I made sure the function was public. I just don't know how to fix the problem. Is there a way to get the address to a function in an instantiated class that can be called without the class specifier/scope resolution? Or am I going at this the wrong way, entirely? Any and all suggestions are welcome.

Thank you for your time.
DIY_Gamer
DIY_Gamer is offline   Reply With Quote