1>.\sizecbar\scbarg.cpp(59) : error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CSizingControlBarG::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)'
1> Cast from base to derived requires dynamic_cast or static_cast
FYI, ON_WM_NCHITTEST looks like this:
#define ON_WM_NCHITTEST() \
{ WM_NCHITTEST, 0, 0, 0, AfxSig_l_p, \
(AFX_PMSG)(AFX_PMSGW) \
(static_cast< LRESULT (AFX_MSG_CALL CWnd::*)(CPoint) > (&ThisClass :: OnNcHitTest)) },
I don't even understand the error because as far as I can tell, it's casting to base, not to derived and it is using static_cast.
Solution or workaround
PS When are we going to get code formatting in this forum

ON_WM_NCHITTEST (and other MFC macros) won't compile in whidbey
Martin Bushnell
portugal1234
Hi Ted,
We have changed return type of OnNcHitTest because some of return values can be negative, for example HTERROR. The correct return type is LRESULT, and as I see in June CTP, wizards already generate the correct prototype for this method. It was one of the breaking change made in VS2005 because of significant number of customers complaining about UINT being a type of a return value.
Thanks,
Nikola
VC++
rob kraft
ray_ch
Installed Beta2...
The documentation still states it's
afx_msg UINT OnNcHitTest(CPoint point );
But LRESULT is in the MFC sources. And old code won't compile.
Alphi
Yes, you can use _MSC_VER >= 1400
For example,
Fabriciom
Hi Microsoft, why exactly was the return value changed from UINT to LRESULT. I've seen bugs that were placed on the product feedback center relating to the fact that the class wizard no longer matches, but the question remains, why was this changed It forces me to have two separate definitions depending on whether I'm building against 2003 vs. 2005.
Ziper
Yes, I encounterd the same problem. When I changed UINT to LRESULT manually, it compiled ok. But I added the message handler by class property.
So, can we say this is a bug of whidbey
Jim R
Don Barber at WellCare