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 C3867 in MFC

error C3867 in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
6 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.
  • F Offline
    F Offline
    FredrickNorge
    wrote on last edited by
    #1

    i try to start another thread with this code CGLMFCDlg * MyThread= new CGLMFCDlg; _beginthread(MyThread->Thread, 0,NULL); delete MyThread; the new thread is a void function, i get a error message as follows: error C3867: 'CGLMFCDlg::Thread': function call missing argument list; use '&CGLMFCDlg::Thread' to create a pointer to member Any sugestions on how i can solve this? thanks

    M E 2 Replies Last reply
    0
    • F FredrickNorge

      i try to start another thread with this code CGLMFCDlg * MyThread= new CGLMFCDlg; _beginthread(MyThread->Thread, 0,NULL); delete MyThread; the new thread is a void function, i get a error message as follows: error C3867: 'CGLMFCDlg::Thread': function call missing argument list; use '&CGLMFCDlg::Thread' to create a pointer to member Any sugestions on how i can solve this? thanks

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      For an address of a member function the compiler is expecting you to use the address-of operator: _beginthread(&MyThread::Thread, 0,NULL);

      F 1 Reply Last reply
      0
      • M Mark Salsbery

        For an address of a member function the compiler is expecting you to use the address-of operator: _beginthread(&MyThread::Thread, 0,NULL);

        F Offline
        F Offline
        FredrickNorge
        wrote on last edited by
        #3

        that gives me an error like this error C2664: '_beginthread' : cannot convert parameter 1 from 'void (__thiscall CGLMFCDlg::* )(void)' to 'void (__cdecl *)(void *)' 1> There is no context in which this conversion is possible

        M 1 Reply Last reply
        0
        • F FredrickNorge

          that gives me an error like this error C2664: '_beginthread' : cannot convert parameter 1 from 'void (__thiscall CGLMFCDlg::* )(void)' to 'void (__cdecl *)(void *)' 1> There is no context in which this conversion is possible

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          The thread proc needs to be defined correctly. For a member function it needs to be declared static. Mark

          1 Reply Last reply
          0
          • F FredrickNorge

            i try to start another thread with this code CGLMFCDlg * MyThread= new CGLMFCDlg; _beginthread(MyThread->Thread, 0,NULL); delete MyThread; the new thread is a void function, i get a error message as follows: error C3867: 'CGLMFCDlg::Thread': function call missing argument list; use '&CGLMFCDlg::Thread' to create a pointer to member Any sugestions on how i can solve this? thanks

            E Offline
            E Offline
            Eytukan
            wrote on last edited by
            #5

            It looks like your using MFC, so why not use AfxBeginThread ? No big difference though :). And are you sure MyThread->Thread is static?


            :Gong: 歡迎光臨 吐 西批 :Gong:

            F 1 Reply Last reply
            0
            • E Eytukan

              It looks like your using MFC, so why not use AfxBeginThread ? No big difference though :). And are you sure MyThread->Thread is static?


              :Gong: 歡迎光臨 吐 西批 :Gong:

              F Offline
              F Offline
              FredrickNorge
              wrote on last edited by
              #6

              thanks, that solves 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