I have a Win32 (MFC) application that serves as an interface to time-consuming scientific computation. Currently I have the main interface thread start the scientific computation in a separate worker-thread (using AfxBeginThread()). I also pass a pointer to a relatively large parameter structure/object to the scientific worker-thread function. The structure contains a number of control parameters and input/output file names. One of the parameters is a Boolean variable, which gives main thread power to terminate the worker-thread function in the middle of its computation, if necessary. The worker thread also communicates back with the main thread (using windows messages) to update the Progress Bar, status, etc.
My employer now wants me to separate the main interface thread and the time-intensive worker thread into separate processes. The idea is to give users the ability to look at and modify the scientific code, but not the interface code. That’s where I am at right now. I realize I can use CreateProcess() and ShellExecuteEx()/ShellExecute() functions to start the scientific worker-process from the main interface-process. The user would have to enter (in the main interface-process) the path name to the executable they obtained after recompiling the scientific worker-program. I can also probably stuff all of the parameters: about 15 numbers and 20 long input/output file names into the parameter character string. However, how do I terminate such process in mid-run at will from the main interface? Also, how can the scientific worker-process communicate with the main interface-process to update its status information, progress bar, etc.? Would 2-way communication be possible with such setup? If not, could anyone suggest an alternative setup?
I would appreciate any help/advice/code you could offer me.
Thank you in advance.