For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > Errors reported in VS 2005









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Errors reported in VS 2005
Drew

2005-11-23, 7:04 pm

I'm trying to move an app from VS6 to VS2005 and am getting some errors
in message map:

3>.\MyApp.cpp(720) : error C2440: 'static_cast' : cannot convert from 'void
(__thiscall CMyApp::* )(BOOL,HTASK)' to 'void (__thiscall
CWnd::* )(BOOL,DWORD)'
3> Cast from base to derived requires dynamic_cast or static_cast

on this line:

ON_WM_ACTIVATEAPP()

and:

3>.\MyApp.cpp(934) : error C2440: 'static_cast' : cannot convert from 'void
(__thiscall CMyApp::* )(UINT)' to 'BOOL (__thiscall
CCmdTarget::* )(UINT,NMHDR *,LRESULT *)'
3> None of the functions with this name in scope match the target
type

on this line:

ON_NOTIFY_EX(TBN_DROPDOWN, ID_DISPLAY_SOMETHING, OnDisplayButtonMenu)

What is the solution to this?

Thanks,
Drew


Igor Tandetnik

2005-11-23, 7:04 pm

Drew <drew.myers@esrd.com> wrote:
> I'm trying to move an app from VS6 to VS2005 and am getting some
> errors in message map:
>
> 3>.\MyApp.cpp(720) : error C2440: 'static_cast' : cannot convert from
> 'void (__thiscall CMyApp::* )(BOOL,HTASK)' to 'void (__thiscall
> CWnd::* )(BOOL,DWORD)'
> 3> Cast from base to derived requires dynamic_cast or
> static_cast
> on this line:
>
> ON_WM_ACTIVATEAPP()


In VC6, the handler for ON_WM_ACTIVATEAPP was expected to be

afx_msg void OnActivateApp( BOOL, HANDLE);

In VC7, it has been changed to

afx_msg void OnActivateApp( BOOL, DWORD );

Update your signature.

> and:
>
> 3>.\MyApp.cpp(934) : error C2440: 'static_cast' : cannot convert from
> 'void (__thiscall CMyApp::* )(UINT)' to 'BOOL (__thiscall
> CCmdTarget::* )(UINT,NMHDR *,LRESULT *)'
> 3> None of the functions with this name in scope match the
> target type
>
> on this line:
>
> ON_NOTIFY_EX(TBN_DROPDOWN, ID_DISPLAY_SOMETHING, OnDisplayButtonMenu)


I'm not sure why this ever compiled in VC6. The expected signature for
ON_NOTIFY_EX appears to have always been

afx_msg BOOL memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT *
result );

You seem to have something like

afx_msg void OnDisplayButtonMenu( UINT id);

Again, make sure your handler has correct prototype.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Drew

2005-11-23, 7:04 pm

You're right. I don't know why this compiled under VC6. I was using the
same handler
for ON_COMMAND_RANGE which does have the UINT id signature but it never
complained and worked as expected. I've updated the prototypes and things
are fine.

Thanks for your help.

Drew

>
> I'm not sure why this ever compiled in VC6. The expected signature for
> ON_NOTIFY_EX appears to have always been
>
> afx_msg BOOL memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT *
> result );
>
> You seem to have something like
>
> afx_msg void OnDisplayButtonMenu( UINT id);
>
> Again, make sure your handler has correct prototype.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com