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. User-Interface Thread Concept Question

User-Interface Thread Concept Question

Scheduled Pinned Locked Moved C / C++ / MFC
comdesignhelptutorialquestion
3 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.
  • L Offline
    L Offline
    LighthouseJ
    wrote on last edited by
    #1

    I want to be able to show a small dialog box displaying progress while a pre-existing thread does work. I think the UI-threads are the right solution to my problem. I found this page and it looks like just what I need. I don't see how to show a dialog box in the process, only how to utilize CWinThread as a user-interface thread.

    B 1 Reply Last reply
    0
    • L LighthouseJ

      I want to be able to show a small dialog box displaying progress while a pre-existing thread does work. I think the UI-threads are the right solution to my problem. I found this page and it looks like just what I need. I don't see how to show a dialog box in the process, only how to utilize CWinThread as a user-interface thread.

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      You can start the UI thread. Then display a modeless dialog box from within the thread, and close the modeless dialog box when you are done and about to exit the thread. I usually have the primary UI thread create the modelss dialog box, then let a worker thread do a job and post messages to the HWND of the modeless dialog box regarding status, then when the worker thread is done, it signals the main UI thread which can remove the modeless dialog box. You can use RegisterWindowMessage to set up custom messages to communicate from the worker thread to the mdoelss dialog and the main UI thread.

      L 1 Reply Last reply
      0
      • B Blake Miller

        You can start the UI thread. Then display a modeless dialog box from within the thread, and close the modeless dialog box when you are done and about to exit the thread. I usually have the primary UI thread create the modelss dialog box, then let a worker thread do a job and post messages to the HWND of the modeless dialog box regarding status, then when the worker thread is done, it signals the main UI thread which can remove the modeless dialog box. You can use RegisterWindowMessage to set up custom messages to communicate from the worker thread to the mdoelss dialog and the main UI thread.

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

        Thank you for the reply, it's very informative. I looked into a modeless dialog because I doubted I could interface with a modal dialog box. I found the function CreateIndirect(...) but I couldn't close the deal on the arguments so I abandoned it in favor of trying another route which I am not optimistic. I already have a series of handles setup to provide synchronization and I can wait for each event and adjust the dialog appropriately. Can you give me a more detailed sequence of events, possibly with function names and such. I'm having a hard time filling out my CWinThread-derived class, I can't quite define in my mind what should be in my main controlling function and what should be in the UI thread.

        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