Help required to solve erro C2440

  • 13 years ago


            I am working in a porting project (porting from Visual studio 6.0 to VS 2005) i have got the following error.

    error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CServiceMainThread::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'

     code in ServiceMainThread.cpp

     BEGIN_MESSAGE_MAP(CServiceMainThread, CWinThread)
        ON_MESSAGE(WM_THREAD_CLOSE, OnThreadClose)         //Venkat  <------ Error Line

    LRESULT CServiceMainThread::OnThreadClose(WPARAM wParam, LPARAM lParam)            //Venkat



    return TRUE; 



    code in ServiceThreadMain.h

        virtual ~CServiceMainThread();
        BOOL Init();    // 3430A007


        afx_msg LRESULT OnThreadClose(WPARAM, LPARAM);                    //Venkat



    I have gone through many blogs and made changes like adding the class name in the message pump etc.. but nothing turned my way.. Pls help me to resolve this error.. Thanks in advance... 

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”