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. multi threading

multi threading

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++tutorial
5 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.
  • L Offline
    L Offline
    locoone
    wrote on last edited by
    #1

    ok this is going to be a stupid question to 99.9% of you but i cant figure out what im missing i can not figure out how to add the following Controlling Function Example This example shows how to define a controlling function and use it from another portion of the program. UINT MyThreadProc( LPVOID pParam ) { CMyObject* pObject = (CMyObject*)pParam; if (pObject == NULL || !pObject->IsKindOf(RUNTIME_CLASS(CMyObject))) return 1; // if pObject is not valid // do something with 'pObject' return 0; // thread completed successfully } // inside a different function in the program . . . pNewObject = new CMyObject; AfxBeginThread(MyThreadProc, pNewObject); i always get errors on the UNIT what is the right way to implement the controlling function in vc++ 6? im using mfc

    M 1 Reply Last reply
    0
    • L locoone

      ok this is going to be a stupid question to 99.9% of you but i cant figure out what im missing i can not figure out how to add the following Controlling Function Example This example shows how to define a controlling function and use it from another portion of the program. UINT MyThreadProc( LPVOID pParam ) { CMyObject* pObject = (CMyObject*)pParam; if (pObject == NULL || !pObject->IsKindOf(RUNTIME_CLASS(CMyObject))) return 1; // if pObject is not valid // do something with 'pObject' return 0; // thread completed successfully } // inside a different function in the program . . . pNewObject = new CMyObject; AfxBeginThread(MyThreadProc, pNewObject); i always get errors on the UNIT what is the right way to implement the controlling function in vc++ 6? im using mfc

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

      locoone wrote:

      i always get errors on the UNIT what is the right way to implement the controlling function in vc++ 6?

      What specific errors? The proper prototype for the thread procedure is

      UINT __cdecl MyControllingFunction( LPVOID pParam );

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      L 1 Reply Last reply
      0
      • M Mark Salsbery

        locoone wrote:

        i always get errors on the UNIT what is the right way to implement the controlling function in vc++ 6?

        What specific errors? The proper prototype for the thread procedure is

        UINT __cdecl MyControllingFunction( LPVOID pParam );

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        L Offline
        L Offline
        locoone
        wrote on last edited by
        #3

        thank you very much mark you helped and didnt even know it and you missed where i was messing up UNIT <--- mine UINT <--- yours btw i go it working first try after learning to spell lol

        M N 2 Replies Last reply
        0
        • L locoone

          thank you very much mark you helped and didnt even know it and you missed where i was messing up UNIT <--- mine UINT <--- yours btw i go it working first try after learning to spell lol

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

          :)

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • L locoone

            thank you very much mark you helped and didnt even know it and you missed where i was messing up UNIT <--- mine UINT <--- yours btw i go it working first try after learning to spell lol

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            This remind me a maths exam some years ago... 1*1 = 2 :doh:;P;)

            Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you ;)

            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