Porting MFC app from VC6 to 2003

O

Ommund

Hi

I have an MFC application originally developed in VC++ 6.0. The port to VC++
2003 went fine except for a few message handlers:

In the .h file

afx_msg void OnPingFailed( WPARAM wParam, LPARAM lParam);

In the .cpp file
..cpp fil (event map)

ON_THREAD_MESSAGE(ID_AXIS_PING_FAILED, OnPingFailed)
og

void CDbServer3Dlg::OnPingFailed( WPARAM wParam, LPARAM lParam)
{

// Do nothing, but provide some trace for debugging
int iServerIndex = static_cast<int>(wParam);

...
return;
}

The application is a simple dialogue based application where CDbServer3Dlg
is derived from CDialog.

I get the following error messages when the code is compiled in VC++ 2003
d:\AutroOS\Product\Server\DB_Server\src\DbServer3Dlg.cpp(118) : error
C2440: 'static_cast' : cannot convert from 'void (__thiscall
CDbServer3Dlg::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::*
)(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type

in task list:
d:\AutroOS\Product\Server\DB_Server\src\DbServer3Dlg.cpp(118): error C2440:
'static_cast' : cannot convert from 'void (__thiscall CDbServer3Dlg::*
)(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)'

Does anyone know what the problem might be?

Regards
Ommund
 
J

Jeff Partch [MVP]

Ommund said:
Hi

I have an MFC application originally developed in VC++ 6.0. The port to VC++
2003 went fine except for a few message handlers:

In the .h file

afx_msg void OnPingFailed( WPARAM wParam, LPARAM lParam);

In the .cpp file
.cpp fil (event map)

ON_THREAD_MESSAGE(ID_AXIS_PING_FAILED, OnPingFailed)
og

void CDbServer3Dlg::OnPingFailed( WPARAM wParam, LPARAM lParam)
{

// Do nothing, but provide some trace for debugging
int iServerIndex = static_cast<int>(wParam);

...
return;
}

The application is a simple dialogue based application where CDbServer3Dlg
is derived from CDialog.

I get the following error messages when the code is compiled in VC++ 2003
d:\AutroOS\Product\Server\DB_Server\src\DbServer3Dlg.cpp(118) : error
C2440: 'static_cast' : cannot convert from 'void (__thiscall
CDbServer3Dlg::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::*
)(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type

in task list:
d:\AutroOS\Product\Server\DB_Server\src\DbServer3Dlg.cpp(118): error C2440:
'static_cast' : cannot convert from 'void (__thiscall CDbServer3Dlg::*
)(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)'

Does anyone know what the problem might be?

I think it's telling you that CDbServer3Dlg does not derive from CWinThread
and that ON_THREAD_MESSAGE requires such derivation. Presumably
CDbServer3Dlg derives from CWnd and in which case ON_MESSAGE would be more
appropriate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top