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. Thread help

Thread help

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpannouncement
5 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.
  • J Offline
    J Offline
    jimNLX
    wrote on last edited by
    #1

    I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim

    I J D 3 Replies Last reply
    0
    • J jimNLX

      I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim

      I Offline
      I Offline
      includeh10
      wrote on last edited by
      #2

      or just use CreateThread() function. search the function in samples of VC CD, there are lots examples there and very easy to be used. includeh10

      M 1 Reply Last reply
      0
      • J jimNLX

        I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim

        J Offline
        J Offline
        jhwurmbach
        wrote on last edited by
        #3

        For a good article read here![^]


        Who is 'General Failure'? And why is he reading my harddisk?!?

        1 Reply Last reply
        0
        • I includeh10

          or just use CreateThread() function. search the function in samples of VC CD, there are lots examples there and very easy to be used. includeh10

          M Offline
          M Offline
          Mike Dimmick
          wrote on last edited by
          #4

          Or, in fact, don't. CreateThread does not set up the C runtime library correctly. You may get away with it in a project that uses the DLL version of the CRT, because the CRT DLL's DllMain does mostly sort it out. If you're not using MFC, create a new thread with _beginthreadex. If you are using MFC, use AfxBeginThread, because again, some initialisation is required for the new thread.

          1 Reply Last reply
          0
          • J jimNLX

            I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            jimNLX wrote: I tried AFXBeginThreat(func.cpp) nada! Threatening a function is no way to get it to behave! The first parameter to AfxBeginThread() is not a filename, but a controlling function for the thread. It has a signature of:

            UINT MyThreadProc( LPVOID pParam );


            Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

            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