T
Turbo_King
Hi,
I am trying to write a class which creates a window and then assigns a
method of the class as the wndproc function for the window so that
each instance of the class can handle the messages for its repective
form.
I am trying to do the following:
class myWinClass {
.....
private: LRESULT CALLBACK _wndProc(HWND, UINT, WPARAM, LPARAM);
.....
}
.....
WNDCLASS wc;
.....
wc.lpfnWndProc = (WNDPROC)&_wndProc;
.....
But this raises the following compile error under Borland C++ 5.5
Compiler:
"Cannot cast from 'long (__stdcall * (_closure )(HWND__ *,unsigned
int,unsigned int,long))(HWND__ *,unsigned int,unsigned int,long)'
to
'long (__stdcall *)(HWND__ *,unsigned int,unsigned int,long)'"
I should imagine this is a general c++ syntax problem and would happen
on any c++ compiler not just Borland's.
I can see that a method is not the same as a normal function (it has
the implicit this pointer for example) but would like to know if there
is a way to get this to work.
Thanks for your help
Gareth Williams
I am trying to write a class which creates a window and then assigns a
method of the class as the wndproc function for the window so that
each instance of the class can handle the messages for its repective
form.
I am trying to do the following:
class myWinClass {
.....
private: LRESULT CALLBACK _wndProc(HWND, UINT, WPARAM, LPARAM);
.....
}
.....
WNDCLASS wc;
.....
wc.lpfnWndProc = (WNDPROC)&_wndProc;
.....
But this raises the following compile error under Borland C++ 5.5
Compiler:
"Cannot cast from 'long (__stdcall * (_closure )(HWND__ *,unsigned
int,unsigned int,long))(HWND__ *,unsigned int,unsigned int,long)'
to
'long (__stdcall *)(HWND__ *,unsigned int,unsigned int,long)'"
I should imagine this is a general c++ syntax problem and would happen
on any c++ compiler not just Borland's.
I can see that a method is not the same as a normal function (it has
the implicit this pointer for example) but would like to know if there
is a way to get this to work.
Thanks for your help
Gareth Williams