|
Boost : |
From: DudeSan (dudesan_at_[hidden])
Date: 2003-01-30 08:09:15
Hey there!
I've had some problems trying to make a function pointer to a specific
windows callback function. It's defined as "LRESULT CALLBACK WndProc(
HWND
hWnd, UINT message, WPARAM wParam, LPARAM lParam )", however, any sore
attempt I try to get the boost::bind working with it seems to fail
miserably.
My latest attempt (which seems to generate the least number of errors)
is
this:
wcex.lpfnWndProc = ( WNDPROC ) boost::bind( &WndProc, _1, _2, _3, _4 );
wcex is an instance of WNDCLASSEX (which is a windows specific function
pointer).
WNDPROC is defined as "typedef LRESULT __pascal* WNDPROC (HWND, UINT,
WPARAM, LPARAM)"
The errors is get are:
error C2664: 'class boost::_bi::bind_t<long,long (__cdecl*)(struct
HWND__
*,unsigned int,unsigned int,long),class boost::_bi::list4<class
boost::arg<1>,class boost::arg<2>,class boost::arg<3>,class
boost::arg<4> >
> __cdecl boost::bind(long (__cdecl *)(struct HWND__ *,unsigned
int,unsigned
int,long),class boost::arg<1>,class boost::arg<2>,class
boost::arg<3>,class
boost::arg<4>)' : cannot convert parameter 1 from 'long (__stdcall
*)(struct
HWND__ *,unsigned int,unsigned int,long)' to 'long (__cdecl *)(struct
HWND__
*,unsigned int,unsigned int,long)'
This conversion requires a reinterpret_cast, a C-style cast or
function-style cast
error C2664: 'class boost::_bi::bind_t<long,long (__cdecl*)(struct
HWND__
*,unsigned int,unsigned int,long),class boost::_bi::list4<class
boost::arg<1>,class boost::arg<2>,class boost::arg<3>,class
boost::arg<4> >
> __cdecl boost::bind(long (__cdecl *)(struct HWND__ *,unsigned
int,unsigned
int,long),class boost::arg<1>,class boost::arg<2>,class
boost::arg<3>,class
boost::arg<4>)' : cannot convert parameter 1 from 'long (__stdcall
*)(struct
HWND__ *,unsigned int,unsigned int,long)' to 'long (__cdecl *)(struct
HWND__
*,unsigned int,unsigned int,long)'
This conversion requires a reinterpret_cast, a C-style cast or
function-style cast.
This probably is a newbie question but let me know the answer anyway ;)
-- Divide
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk