AlpineMan
02-17-2005, 04:25 PM
[Visual Studio .NET 2002]
[VC 7.0]
[Max 7 SDK]
This question is actually purely windows related.
I am writing a new rolloutcontrol, and attempting to point a window procedure to the .lpfnWndProc member of the WNDCLASS(EX) struct. My class contains a WinProc member function is like so:
class ChrisButton
{
public:
LRESULT CALLBACK myWinProc(....);
};
LRESULT CALLBACK ChrisButton::WndProc(.... bla bla)
{
//...more stuff
}
I then attempt to assign that WndProc to my windowclass like so:
WNDCLASSEX wc;
...
wc.lpfnWndProc = ChrisButton::WndProc;
...
...
if(!RegisterClassEx(&wc))
...
Whereupon I get a compile error at this line:
wc.lpfnWndProc = ChrisButton::WndProc;
saying:
error C2440: '=' : cannot convert from 'LRESULT (__stdcall ChrisButton::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'
There is no context in which this conversion is possible
What is going on? Anyone have any idea why I cannot assign that function to the windows class? Cannot convert an LRESULT to a WNDPROC? Petzold does this in his book everywhere? Am I missing a settings somewhere?
I have tried looking everywhere on MSDN, and tried looking everywhere on microsoft as well. I've checked Petzold, and his function prototypes are exactly the same as mine, so what gives?
Chris J.
[VC 7.0]
[Max 7 SDK]
This question is actually purely windows related.
I am writing a new rolloutcontrol, and attempting to point a window procedure to the .lpfnWndProc member of the WNDCLASS(EX) struct. My class contains a WinProc member function is like so:
class ChrisButton
{
public:
LRESULT CALLBACK myWinProc(....);
};
LRESULT CALLBACK ChrisButton::WndProc(.... bla bla)
{
//...more stuff
}
I then attempt to assign that WndProc to my windowclass like so:
WNDCLASSEX wc;
...
wc.lpfnWndProc = ChrisButton::WndProc;
...
...
if(!RegisterClassEx(&wc))
...
Whereupon I get a compile error at this line:
wc.lpfnWndProc = ChrisButton::WndProc;
saying:
error C2440: '=' : cannot convert from 'LRESULT (__stdcall ChrisButton::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'
There is no context in which this conversion is possible
What is going on? Anyone have any idea why I cannot assign that function to the windows class? Cannot convert an LRESULT to a WNDPROC? Petzold does this in his book everywhere? Am I missing a settings somewhere?
I have tried looking everywhere on MSDN, and tried looking everywhere on microsoft as well. I've checked Petzold, and his function prototypes are exactly the same as mine, so what gives?
Chris J.
