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. QuickWin

QuickWin

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharphelptutorial
7 Posts 2 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.
  • U Offline
    U Offline
    User 625201
    wrote on last edited by
    #1

    I downloaded the QuickWin example and opened the .sln file with "MS Visual C++ .net 2003". It asked to convertthe files, which I did. It compiled with the following error: QuickWin.cpp(195) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CQuickWinApp::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)' I had a buddy try it under VC++ 6 and he had no problems. Does anyone have any ideas or pointers. Thanks DCrawford999

    P 1 Reply Last reply
    0
    • U User 625201

      I downloaded the QuickWin example and opened the .sln file with "MS Visual C++ .net 2003". It asked to convertthe files, which I did. It compiled with the following error: QuickWin.cpp(195) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CQuickWinApp::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)' I had a buddy try it under VC++ 6 and he had no problems. Does anyone have any ideas or pointers. Thanks DCrawford999

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #2

      With VC7 user defined message handlers have to return an LRESULT, they can no longer be void functions. VC6 allowed void functions.

      // in message map
      ON_MESSAGE (WM_MYMESSAGE, OnMyMessage)

      // VC6
      void CMyApp::OnMyMessage(WPARAM wp, LPARAM lp)
      {
      // whatever
      }

      // VC7
      LRESULT CMyApp::OnMyMessage(WPARAM wp, LPARAM lp)
      {
      // whatever
      return 0;
      }


      [

      ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

      U 1 Reply Last reply
      0
      • P PJ Arends

        With VC7 user defined message handlers have to return an LRESULT, they can no longer be void functions. VC6 allowed void functions.

        // in message map
        ON_MESSAGE (WM_MYMESSAGE, OnMyMessage)

        // VC6
        void CMyApp::OnMyMessage(WPARAM wp, LPARAM lp)
        {
        // whatever
        }

        // VC7
        LRESULT CMyApp::OnMyMessage(WPARAM wp, LPARAM lp)
        {
        // whatever
        return 0;
        }


        [

        ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

        U Offline
        U Offline
        User 625201
        wrote on last edited by
        #3

        The void is coming from afxmsg.h dealing ON_REGISTERED_THREAD_MESSAGE but I am not sure how too clear up the conflict. ON_REGISTERED_THREAD_MESSAGE(WM_STDIO_COMMAND, OnStdioCommand) // for Thread messages #define ON_THREAD_MESSAGE(message, memberFxn) \ { message, 0, 0, 0, AfxSig_vwl, \ (AFX_PMSG)(AFX_PMSGT) \ (static_cast< void (AFX_MSG_CALL CWinThread::*)(WPARAM, LPARAM) > \ (memberFxn)) }

        P 1 Reply Last reply
        0
        • U User 625201

          The void is coming from afxmsg.h dealing ON_REGISTERED_THREAD_MESSAGE but I am not sure how too clear up the conflict. ON_REGISTERED_THREAD_MESSAGE(WM_STDIO_COMMAND, OnStdioCommand) // for Thread messages #define ON_THREAD_MESSAGE(message, memberFxn) \ { message, 0, 0, 0, AfxSig_vwl, \ (AFX_PMSG)(AFX_PMSGT) \ (static_cast< void (AFX_MSG_CALL CWinThread::*)(WPARAM, LPARAM) > \ (memberFxn)) }

          P Offline
          P Offline
          PJ Arends
          wrote on last edited by
          #4

          Read the first 200 lines of AfxSig_.h. It explains a lot of how the naming convention of functions work.

          AfxSig_vwl = AfxSig_v_w_l, // void (UINT, LPARAM)

          means your OnStdioCommand prototype has to be

          void CMyWinThread::OnStdioCommand(UINT uInt, LPARAM lParam)

          I hope this helps.


          [

          ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

          U 1 Reply Last reply
          0
          • P PJ Arends

            Read the first 200 lines of AfxSig_.h. It explains a lot of how the naming convention of functions work.

            AfxSig_vwl = AfxSig_v_w_l, // void (UINT, LPARAM)

            means your OnStdioCommand prototype has to be

            void CMyWinThread::OnStdioCommand(UINT uInt, LPARAM lParam)

            I hope this helps.


            [

            ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

            U Offline
            U Offline
            User 625201
            wrote on last edited by
            #5

            If I change it to a VOID and remove the return, I get: QuickWin.cpp(196) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CQuickWinApp::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)' None of the functions with this name in scope match the target type DCrawford999

            P 1 Reply Last reply
            0
            • U User 625201

              If I change it to a VOID and remove the return, I get: QuickWin.cpp(196) : error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CQuickWinApp::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)' None of the functions with this name in scope match the target type DCrawford999

              P Offline
              P Offline
              PJ Arends
              wrote on last edited by
              #6

              Did you also change the function prototype in the header file? Look up C2440 in MSDN for more info on the error message. I am starting to guess here, as I do not have your code in front of me


              [

              ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

              U 1 Reply Last reply
              0
              • P PJ Arends

                Did you also change the function prototype in the header file? Look up C2440 in MSDN for more info on the error message. I am starting to guess here, as I do not have your code in front of me


                [

                ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

                U Offline
                U Offline
                User 625201
                wrote on last edited by
                #7

                Many thanks. I forgot to change the prototype (rookie mistake). DCrawford999

                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