From: Jim Langston on
I'm trying to compile a VC++ 6.0 project in my VC++ .net 2003 compiler. I
opened the project and told it to convert it when it asked and did a
compile. But I get 2 errors both on the same type of line. The errors are:

c:\temp\ZipDemo\TextProgressCtrl.cpp(145) : error C2440: 'static_cast' :
cannot convert from 'LRESULT (__thiscall
CTextProgressCtrl::* )(UINT,LPCTSTR)' to 'LRESULT (__thiscall
CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
c:\temp\ZipDemo\TextProgressCtrl.cpp(146) : error C2440: 'static_cast' :
cannot convert from 'LRESULT (__thiscall
CTextProgressCtrl::* )(UINT,LPTSTR)' to 'LRESULT (__thiscall
CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type

The errors occur in this code:

BEGIN_MESSAGE_MAP(CTextProgressCtrl, CProgressCtrl)
//{{AFX_MSG_MAP(CTextProgressCtrl)
ON_WM_ERASEBKGND()
ON_WM_PAINT()
ON_WM_SIZE()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SETTEXT, OnSetText)
ON_MESSAGE(WM_GETTEXT, OnGetText)
END_MESSAGE_MAP()

on the ON_MESSAGE lines.

How do I fix this? Thanks.


From: Jeff Partch [MVP] on
"Jim Langston" <tazmaster(a)rocketmail.com> wrote in message
news:3mgkf.1220$0u6.1048(a)fe06.lga...
> I'm trying to compile a VC++ 6.0 project in my VC++ .net 2003 compiler. I
> opened the project and told it to convert it when it asked and did a
> compile. But I get 2 errors both on the same type of line. The errors
are:
>
> c:\temp\ZipDemo\TextProgressCtrl.cpp(145) : error C2440: 'static_cast' :
> cannot convert from 'LRESULT (__thiscall
> CTextProgressCtrl::* )(UINT,LPCTSTR)' to 'LRESULT (__thiscall
> CWnd::* )(WPARAM,LPARAM)'
>
> How do I fix this? Thanks.

Make sure your ON_MESSAGE handlers are declared properly:

LRESULT CWndClass::MemberFxn(WPARAM, LPARAM)
--
Jeff Partch [VC++ MVP]


From: Jim Langston on
"Jeff Partch [MVP]" <jeffp(a)mvps.org> wrote in message
news:uLBwAjA%23FHA.2176(a)TK2MSFTNGP09.phx.gbl...
> "Jim Langston" <tazmaster(a)rocketmail.com> wrote in message
> news:3mgkf.1220$0u6.1048(a)fe06.lga...
>> I'm trying to compile a VC++ 6.0 project in my VC++ .net 2003 compiler.
>> I
>> opened the project and told it to convert it when it asked and did a
>> compile. But I get 2 errors both on the same type of line. The errors
> are:
>>
>> c:\temp\ZipDemo\TextProgressCtrl.cpp(145) : error C2440: 'static_cast' :
>> cannot convert from 'LRESULT (__thiscall
>> CTextProgressCtrl::* )(UINT,LPCTSTR)' to 'LRESULT (__thiscall
>> CWnd::* )(WPARAM,LPARAM)'
>>
>> How do I fix this? Thanks.
>
> Make sure your ON_MESSAGE handlers are declared properly:
>
> LRESULT CWndClass::MemberFxn(WPARAM, LPARAM)

Thanks, searching for the actual functions that were being passed in, I
changed their parms to WPARAM and LPARAM and did casting in the fuctions
where needed.

Program compiles and seems to work.

Thanks.