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. How to create indefinite number of UI-thread with MFC

How to create indefinite number of UI-thread with MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++designhelptutorialquestion
2 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.
  • G Offline
    G Offline
    GameProfessor
    wrote on last edited by
    #1

    hi, I need to create many UI-threads using MFC. Each thread must run all the time and is able to send/receive message with main thread. I assume that I will have to create a CMyThread:public CWinThread and create many instance of this class in function AfxBeginThread() for UI-thread. But I notice that this function doesn't allow programmer to pass parameters to the newly-created thread. So, how could I start those threads with different initial parameters ? (e.g pass a client address to each thread sothat each thread serve one client only) thanks for any help.

    N 1 Reply Last reply
    0
    • G GameProfessor

      hi, I need to create many UI-threads using MFC. Each thread must run all the time and is able to send/receive message with main thread. I assume that I will have to create a CMyThread:public CWinThread and create many instance of this class in function AfxBeginThread() for UI-thread. But I notice that this function doesn't allow programmer to pass parameters to the newly-created thread. So, how could I start those threads with different initial parameters ? (e.g pass a client address to each thread sothat each thread serve one client only) thanks for any help.

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      GameProfessor wrote:

      So, how could I start those threads with different initial parameters ?

      Here is one way 1.Add a function to the CMyThread class say "Initialize()" 2.Create the thread in the suspended mode. 3.Call the Initialize() function and pass the parameters that you want to pass. 4.Resume the thread.

      nave

      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