locked
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CSimulationLMITCView::* )(bool,UINT)' to 'void (__thiscall CWnd::* )(BOOL,UINT) RRS feed

  • Question

  • Hi,

    When I converted VC6 code to Visual Studio 2010 I got error message:

    error C2440: 'static_cast' : cannot convert from 'void (__thiscall CSimulationLMITCView::* )(bool,UINT)' to 'void (__thiscall CWnd::* )(BOOL,UINT)

    The error points to following line (in bold underline):

    BEGIN_MESSAGE_MAP(CSimulationLMITCView, CSimulationView)
     //{{AFX_MSG_MAP(CSimulationLMITCView)
     ON_WM_CREATE()
     ON_WM_SHOWWINDOW()
     ON_WM_CTLCOLOR() 
     ON_BN_CLICKED(IDC_UPDATE_STATUS, OnUpdateDIOStatus)
     //}}AFX_MSG_MAP
    END_MESSAGE_MAP()

    #define ON_WM_SHOWWINDOW() \
     { WM_SHOWWINDOW, 0, 0, 0, AfxSig_vbw, \
      (AFX_PMSG)(AFX_PMSGW) \
      (static_cast< void (AFX_MSG_CALL CWnd::*)(BOOL, UINT) > ( &ThisClass :: OnShowWindow)) },

    void CSimulationLMITCView::OnShowWindow(bool bShow, UINT nStatus)

     CSimulationView::OnShowWindow(bShow, nStatus);

     if (bShow == TRUE)
     {
      if (pApp->m_pConfiguration->m_ITC == RITC) 

      {
         if (!m_TMUXModPresenceKnown)
        {
        pApp->m_sendMsg.m_length = sizeof(int)*BITS_PER_BYTE;
        pApp->m_message = RITC_TO_LMITC_IS_TMUX_MOD_FILE_PRESENT;
        pApp->m_sendMsg.m_pData = (char*)&pApp->m_message;

            if (pApp->m_pMainFrame->m_ITCCommunication.SendMsgToITC(&pApp->m_sendMsg, m_lmitcNumber) == true)
        {
         // Display the message in the text box in the view
         DisplayMessage(pITCLogger->m_logMsgString[pITCLogger->Previous()]);
        }
       }
      }
     }
    }

    How to fix this?
    Thanks in advance.


    MFC coder

    Thursday, April 26, 2012 12:41 AM

Answers

  • The error was fixed.

    Thanks.


    MFC coder

    • Marked as answer by MFC coder Thursday, April 26, 2012 7:00 PM
    Thursday, April 26, 2012 4:21 PM

All replies

  • On 4/25/2012 8:41 PM, MFC coder wrote:

    When I converted VC6 code to Visual Studio 2010 I got error message:

    error C2440: 'static_cast' : cannot convert from 'void (__thiscall CSimulationLMITCView::* )(bool,UINT)' to 'void (__thiscall CWnd::* )(BOOL,UINT)

    Change the first parameter of OnShowWindow from bool to BOOL.


    Igor Tandetnik

    Thursday, April 26, 2012 12:55 AM
  • The error was fixed.

    Thanks.


    MFC coder

    • Marked as answer by MFC coder Thursday, April 26, 2012 7:00 PM
    Thursday, April 26, 2012 4:21 PM
  • You should have given the solution. I'm having the exact same issue and this thread is useless and I'm going to report it as irrelevant. Please don't be so selfish next time MFC coder.
    Thursday, December 13, 2012 9:43 PM
  • On 12/13/2012 4:43 PM, jerfrog wrote:

    You should have given the solution. I'm having the exact same issue and this thread is useless and I'm going to report it as irrelevant. Please don't be so selfish next time MFC coder.

    The solution was to - and I quote - "change the first parameter of OnShowWindow from bool to BOOL."


    Igor Tandetnik

    Thursday, December 13, 2012 10:39 PM