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