在VS2005以上的Visual Studio要求C++更加的标准化,所以VC6的代码升级到VS2010很多地方都要修改。
ON_MESSAGE
ON_MESSAGE(message, memberFxn)
注意:memberFxn :The type of the function must be afx_msg LRESULT (CWnd::*)(WPARAM, LPARAM).
例如:
在VC6.0下面定义是没问题的:
ON_MESSAGE(UM_SYNTH_PAUSE, OnSynthThreadPause)
afx_msg void OnSynthThreadPause(WPARAM wParam, LPARAM lParam);
如果放到VS2010编译,会出错:
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CTTSDialogDlg::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
1> None of the functions with this name in scope match the target type
修改:void----->LRESULT,问题解决!
afx_msg LRESULT OnSynthThreadPause(WPARAM wParam, LPARAM lParam);