First off, I'll say it: I am new to c++, so I have very little experience with classes and the like.
Now, here's my situation. I am creating a class for a control. I'll call it clsControl. Now, my clsControl has to have it's own window independant of the main window, so it has to have it's own window class registered to define it's wndproc, right? Well, when I try to set the lpfnWndProc variable of the WNDCLASS structure to my WndProc function within the clsControl class and compile it, it gives me some type cast error crap:
error C2440: 'type cast' : cannot convert from '' to 'long (__cdecl *)(struct HWND__ *,unsigned int,unsigned int,long)'
So the code line looks like this:
Now, if I don't use the (WNDPROC) typecast, I get a conversion error. It says:
error C2440: '=' : cannot convert from 'long (__cdecl clsControl::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__cdecl *)(struct HWND__ *,unsigned int,unsigned int,long)'
It seems to me that it is just impossible to have a wndproc in a class. Am I right, or just ignorant?
TIA.
Now, here's my situation. I am creating a class for a control. I'll call it clsControl. Now, my clsControl has to have it's own window independant of the main window, so it has to have it's own window class registered to define it's wndproc, right? Well, when I try to set the lpfnWndProc variable of the WNDCLASS structure to my WndProc function within the clsControl class and compile it, it gives me some type cast error crap:
error C2440: 'type cast' : cannot convert from '' to 'long (__cdecl *)(struct HWND__ *,unsigned int,unsigned int,long)'
So the code line looks like this:
- Code:
WNDCLASS wc;
wc.lpfnWndProc = (WNDPROC) WndProc;
Now, if I don't use the (WNDPROC) typecast, I get a conversion error. It says:
error C2440: '=' : cannot convert from 'long (__cdecl clsControl::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__cdecl *)(struct HWND__ *,unsigned int,unsigned int,long)'
It seems to me that it is just impossible to have a wndproc in a class. Am I right, or just ignorant?
TIA.