tags:

views:

32

answers:

1

I get this error when compiling the following source from here:

Error 1 error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CStaticLink::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)' e:\development\tooltips\cqa0311\statlink.cpp 28

The line of code is for the ON_WM_NCHITTEST below

BEGIN_MESSAGE_MAP(CStaticLink, CStatic)
    ON_WM_NCHITTEST()
    ON_WM_CTLCOLOR_REFLECT()
    ON_WM_LBUTTONUP()
    ON_WM_SETCURSOR()
END_MESSAGE_MAP()

I am not sure what MFC voodoo I have to do to get this to compile. Am I out of luck? I guess this was built with some different version of MFC? I am using VS2008.

(I want to have tooltips for my menu items as described on that webpage.)

+1  A: 

From here:

Thanks for the report. I investigated and found that this change was by design, in MFC for Visual Studio 2005. This introduced a source incompatibility, so you will need to update your OnNcHitTest method to return an LRESULT instead of a UINT.

Pat Brenner
Visual C++ Libraries Development

Now OnNcHitTest should be declared as follows:

afx_msg LRESULT OnNcHitTest(
   CPoint point 
);
Kirill V. Lyadvinsky
Now I feel pretty dumb, but thanks. The macro threw me off the scent there. ON_WM_NCHITTEST() - gosh, how I despise MFC and all that macro voodoo.
Tim