Greetings,
I am trying to PostMessage from a user defined generic class/object in
MFC Dialog based application to Dialog/main window. I don't know how
to do that. I am utilizing worker threads. A thread instantiates an
object(from user defined generic class) and utilizes newly created
object. What user defined object code does is actually launch a
process, for sake for argument lets say, Windows Notepad.exe using
CreateProcess. As long as that process is running, I want to
PostMessage that updates a progress bar on Main GUI dialog. I can do
it if I embed the code right into my application by writing the code
directly into it or declare, define and use member function of Dialog/
main program itself. But I want to learn new material by incorporting
a user defined class and then interacting with main application code.
To recap:
MFC Dialog based Main application exectues-> It launches a thread. ->
Thread uses user defined generic class to instantiate a new object. -
New Object should run and should PostMessage to Main window to
update progress bar.
Again, I don't know how to do this. How to tell newly created object
from user defined class, which is running within a Worker Thread, to
successfully post message to main GUI? I know that Worker threads are
not allowed to interact with GUI objects.
Any good software engineering solution will be greatly appreciated. I
thank you.
the main window. This can be passed into to the thread function via the
thread parameter.
object. Example here...