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. DIALOG WITH MULTIPLE THREADS

DIALOG WITH MULTIPLE THREADS

Scheduled Pinned Locked Moved C / C++ / MFC
designcsharpc++visual-studiodata-structures
3 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.
  • U Offline
    U Offline
    User 11392307
    wrote on last edited by
    #1

    Hi I have Dialog based mfc applciation using visual studio 2013.

    Dialog contains multiple controls. It has two threads - main ui thread and worker thread

    In a particular control (some static test) i have to show some counts (like number of Cars produced

    and Number of Bikes prodcued, and total ). Actually these counts are given by worker thread.

    Worker thread continuously gives the counts (that is live data)

    I have to update UI from main thread based on these data lively.

    Please help me to design this use case. My ui contains multiple controls. I don't want to block the UI

    How to pass the data(counts) from worker thread to main thread? how to avoid block in main thread?

    Is there any need for queue or another thread?

    That is UI will be some thing like

    number of Cars produced:10

    number of Bikes produced: 20

    Total: 30

    L V 2 Replies Last reply
    0
    • U User 11392307

      Hi I have Dialog based mfc applciation using visual studio 2013.

      Dialog contains multiple controls. It has two threads - main ui thread and worker thread

      In a particular control (some static test) i have to show some counts (like number of Cars produced

      and Number of Bikes prodcued, and total ). Actually these counts are given by worker thread.

      Worker thread continuously gives the counts (that is live data)

      I have to update UI from main thread based on these data lively.

      Please help me to design this use case. My ui contains multiple controls. I don't want to block the UI

      How to pass the data(counts) from worker thread to main thread? how to avoid block in main thread?

      Is there any need for queue or another thread?

      That is UI will be some thing like

      number of Cars produced:10

      number of Bikes produced: 20

      Total: 30

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Member 11426624 wrote:

      Is there any need for queue or another thread?

      No, you could just use the PostMessage function[^] from the worker thread to pass a custom window message[^] to the UI thread to update the counts and that would be non-blocking. Best Wishes, -David Delaune

      1 Reply Last reply
      0
      • U User 11392307

        Hi I have Dialog based mfc applciation using visual studio 2013.

        Dialog contains multiple controls. It has two threads - main ui thread and worker thread

        In a particular control (some static test) i have to show some counts (like number of Cars produced

        and Number of Bikes prodcued, and total ). Actually these counts are given by worker thread.

        Worker thread continuously gives the counts (that is live data)

        I have to update UI from main thread based on these data lively.

        Please help me to design this use case. My ui contains multiple controls. I don't want to block the UI

        How to pass the data(counts) from worker thread to main thread? how to avoid block in main thread?

        Is there any need for queue or another thread?

        That is UI will be some thing like

        number of Cars produced:10

        number of Bikes produced: 20

        Total: 30

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        It is how you should use/implement it: [WorkerThreads](http://www.flounder.com/workerthreads.htm)

        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