Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ...................

error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ...................

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++visual-studio
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deadlyabbas
    wrote on last edited by
    #1

    Hi, I am getting the following error when I am building my project in Visual Studio 2005. Error 134 error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CCancelUIThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' d:\CBSTellerLatest\IDManager\CancelThread.cpp 138 I am not getting any error when I runm the same code on Visual Studio 6.0 The Code is as Follows Code in .H file

    // Generated message map functions
    //{{AFX\_MSG(CCancelUIThread)
    afx\_msg LRESULT OnStepProgress(WPARAM wParam, LPARAM lParam);
    afx\_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
    //}}AFX\_MSG
    

    Code in .CPP file

    BEGIN_MESSAGE_MAP(CCancelUIThread, CWinThread)
    //{{AFX_MSG_MAP(CCancelUIThread)
    ON_MESSAGE(CM_PROGRESS_STEPIT, OnStepProgress)
    ON_MESSAGE(CM_PROGRESS_SETTEXT, OnSetText)
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()

    And the function definations. Please help me out. Thanks In Advance

    D S 2 Replies Last reply
    0
    • D deadlyabbas

      Hi, I am getting the following error when I am building my project in Visual Studio 2005. Error 134 error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CCancelUIThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' d:\CBSTellerLatest\IDManager\CancelThread.cpp 138 I am not getting any error when I runm the same code on Visual Studio 6.0 The Code is as Follows Code in .H file

      // Generated message map functions
      //{{AFX\_MSG(CCancelUIThread)
      afx\_msg LRESULT OnStepProgress(WPARAM wParam, LPARAM lParam);
      afx\_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
      //}}AFX\_MSG
      

      Code in .CPP file

      BEGIN_MESSAGE_MAP(CCancelUIThread, CWinThread)
      //{{AFX_MSG_MAP(CCancelUIThread)
      ON_MESSAGE(CM_PROGRESS_STEPIT, OnStepProgress)
      ON_MESSAGE(CM_PROGRESS_SETTEXT, OnSetText)
      //}}AFX_MSG_MAP
      END_MESSAGE_MAP()

      And the function definations. Please help me out. Thanks In Advance

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      What is line 138? Have you tried:

      ON_MESSAGE(CM_PROGRESS_STEPIT, &CCancelUIThread::OnStepProgress)

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      1 Reply Last reply
      0
      • D deadlyabbas

        Hi, I am getting the following error when I am building my project in Visual Studio 2005. Error 134 error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CCancelUIThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' d:\CBSTellerLatest\IDManager\CancelThread.cpp 138 I am not getting any error when I runm the same code on Visual Studio 6.0 The Code is as Follows Code in .H file

        // Generated message map functions
        //{{AFX\_MSG(CCancelUIThread)
        afx\_msg LRESULT OnStepProgress(WPARAM wParam, LPARAM lParam);
        afx\_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
        //}}AFX\_MSG
        

        Code in .CPP file

        BEGIN_MESSAGE_MAP(CCancelUIThread, CWinThread)
        //{{AFX_MSG_MAP(CCancelUIThread)
        ON_MESSAGE(CM_PROGRESS_STEPIT, OnStepProgress)
        ON_MESSAGE(CM_PROGRESS_SETTEXT, OnSetText)
        //}}AFX_MSG_MAP
        END_MESSAGE_MAP()

        And the function definations. Please help me out. Thanks In Advance

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        Ummm - a CWinThread is not a CWnd, so it can't have ON_MESSAGE handlers. It *can* have ON_THREAD_MESSAGE handlers, though…so use those instead... The reason VC6 doesn't complain is that its compiler is so lax at checking and enforcing static typing rules. That's a bad thing, m'kay, 'cause it means there can be many latent, potential bugs left in your code.

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups