Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-30 11:14:42


From: "DudeSan" <dudesan_at_[hidden]>
> 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)"

No, this won't work. boost::bind returns a function object, an object with
operator() defined, not a function pointer. You can't use bind() to create a
function pointer.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk