0
votes

After converting VC++ 6 project to VC++ 2010 I've fixed all error but one of them I cannot find solution. An Error which I received when building:

Error 1 error C2440: 'static_cast' : cannot convert from 'void (__thiscall CUploadDlg::* )(void)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'

Error code:

BEGIN_MESSAGE_MAP(CUploadDlg, CDialog)
    //{{AFX_MSG_MAP(CUploadDlg)
    ON_MESSAGE(PARSE_DB_MSG, ParseUserDb)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

Code of called method:

void CUploadDlg::ParseUserDb()
{
    m_parse_db.ShowWindow(SW_SHOW);    
    m_block_numbers = getBlockNumber();    
    Sleep(1200);    
//  CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();    
//  if(pFrame)  pFrame->UpdateDataBase(m_Path);    
    m_parse_finish.ShowWindow(SW_SHOW);    
//  Sleep(500);    
//  pFrame->SaveDataBase();//    
//  CDialog::OnCancel();
    //return 0L;
}

Project type: Application, uses MFC in a Static Library

1

1 Answers

1
votes

Look at the function prototype expected by the message cracker for MFC message maps. ON_MESSAGE() is a generic wrapper that has no knowledge of how to crack the given message for anything besides the basic msgID (which is how it is distributed to the map). The remaining parameters must be passed on to the message handler, and thus it expected ParseUserDb to look like this:

LRESULT CUploadDialog::ParseUserDb(WPARAM wParam, LPARAM lParam)
{
// your code; don't forget a return value, likely 0L;
};