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. trouble with _beginthread

trouble with _beginthread

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 5 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.
  • N Offline
    N Offline
    NoName II
    wrote on last edited by
    #1

    _beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }

    L M H 3 Replies Last reply
    0
    • N NoName II

      _beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }

      L Offline
      L Offline
      Laxman Auti
      wrote on last edited by
      #2

      NoName II wrote:

      _beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member

      1. Made the CopyProcessTh as a static in the class which returns UINT from the function which is recommended to terminate the thread. OR 2) Seperate out the function from the class with following prototype

      UINT CopyProcessTh(LPVOID pparam)
      {
      //Do your Stuff here.
      return 0;
      }

      Knock out 't' from can't, You can if you think you can :cool:

      N 1 Reply Last reply
      0
      • N NoName II

        _beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        There was a recent change to C++ that says you can't write class_name::function_name to get a pointer to the function, you have to write &class_name::function_name

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        1 Reply Last reply
        0
        • N NoName II

          _beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          See void MyThread( LPVOID pv ); ... ... void CTest::RunThread() { _beginthread(MyThread,0,NULL); } void MyThread( LPVOID pv ) { CTest* m_Answer = (CTest*) pv; m_Answer->Modify(); } void CTest::Modify() { MessageBox("A"); }_**


          **_

          whitesky


          C 1 Reply Last reply
          0
          • L Laxman Auti

            NoName II wrote:

            _beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member

            1. Made the CopyProcessTh as a static in the class which returns UINT from the function which is recommended to terminate the thread. OR 2) Seperate out the function from the class with following prototype

            UINT CopyProcessTh(LPVOID pparam)
            {
            //Do your Stuff here.
            return 0;
            }

            Knock out 't' from can't, You can if you think you can :cool:

            N Offline
            N Offline
            NoName II
            wrote on last edited by
            #5

            I can't made CopyProcessTh as a static cause it should operate with nonstatic members.. as for the 2nd...error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member

            C 1 Reply Last reply
            0
            • H Hamid Taebi

              See void MyThread( LPVOID pv ); ... ... void CTest::RunThread() { _beginthread(MyThread,0,NULL); } void MyThread( LPVOID pv ) { CTest* m_Answer = (CTest*) pv; m_Answer->Modify(); } void CTest::Modify() { MessageBox("A"); }_**


              **_

              whitesky


              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              WhiteSky wrote:

              _beginthread(MyThread,0,NULL);

              You meant _beginthread(MyThread,0,this); no ?


              Cédric Moonen Software developer
              Charting control

              H 1 Reply Last reply
              0
              • N NoName II

                I can't made CopyProcessTh as a static cause it should operate with nonstatic members.. as for the 2nd...error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member

                C Offline
                C Offline
                Cedric Moonen
                wrote on last edited by
                #7

                NoName II wrote:

                I can't made CopyProcessTh as a static cause it should operate with nonstatic members..

                You can't pass a non-static member function to _beginthread. The reason is that static and non-static member functions don't have the same prototype. Non-static member functions have an implicit parameter that is passed: the 'this' parameter. Look at the post of WhyteSky for the 'workaround' to this problem.


                Cédric Moonen Software developer
                Charting control

                1 Reply Last reply
                0
                • C Cedric Moonen

                  WhiteSky wrote:

                  _beginthread(MyThread,0,NULL);

                  You meant _beginthread(MyThread,0,this); no ?


                  Cédric Moonen Software developer
                  Charting control

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  yes:)_**


                  **_

                  whitesky


                  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