error C2440: 'type cast' : cannot convert from 'int *' to 'void (__thiscall CCmdTarget::*)(void)'解决

环境:Microsoft Visual C++ 6.0

问题:自定义消息时,出现如下错误:error C2440: 'type cast' : cannot convert from 'int *' to 'void (__thiscall CCmdTarget::*)(void)' ,There is no context in which this conversion is possible

解决:

看自定义的消息映射是否放错位置:

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)

//{{AFX_MSG_MAP(CAboutDlg)

// No message handlers

//}}AFX_MSG_MAP

BEGIN_MESSAGE_MAP(CMsgInMfcDlg, CDialog)

//{{AFX_MSG_MAP(CMsgInMfcDlg)

ON_WM_SYSCOMMAND()

ON_WM_PAINT()

ON_WM_QUERYDRAGICON()

//}}AFX_MSG_MAP

ON_BN_CLICKED(IDC_BTN_CLEAR, OnBtnClear)

ON_EN_CHANGE(IDC_EDT_INPUT, OnEdtInputChange)

ON_MESSAGE(WM_ERASEBKGND, OnEraseBackground)

END_MESSAGE_MAP()

END_MESSAGE_MAP()

总结:在哪个对话框里自定义的消息,就在哪个对话框里添加映射消息。

你可能感兴趣的:(convert)