|
-
Aug 30th, 2001, 04:28 PM
#1
Thread Starter
New Member
WindowProc within a class
hi all
Im new to api in c++ and am having a problem and cant work it out.
my code works correctly if i keep my WindowProc function outside of my class which i am using for creating and destroying the window. which is why i would also like to handle messages within the same class however when i do this i get the following error message.
bvsetup.cpp(104) : error C2440: '=' : cannot convert from 'long (__stdcall BVSetUp::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND
__ *,unsigned int,unsigned int,long)'
here is a snipit of my code
class BVSetUp
{
public:
BVSetUp();
BVSetUp(HINSTANCE, HINSTANCE, LPSTR, int);
~BVSetUp();
bool CreateGLWin();
void KillGLWindow();
virtual LRESULT CALLBACK WindowProc(HWND , UINT ,WPARAM , LPARAM );
};
bool BVSetUp::CreateGLWin()
{
...
WNDCLASS wc;
...
wc.lpfnWndProc = WindowProc;
...
}
I am using MSVC++6. Anything and everything will be appriciated
Thanks
Zee
-
Aug 31st, 2001, 06:23 AM
#2
window procs can't be normal class members since they don't get a this-pointer. You have to use either a global windproc that calls the class wndproc (like in mfc) or a static member function of the class.
All the buzzt
CornedBee
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|