Reputation: 402
I have to signal the Main thread to run some code from one of the worker thread.
That code must run in the main thread because of some COM issue( running it on the thread just fail).
I was starting to implement it with messages and event (i need to wait the code to be executed before going foward) when i remebered there was some very simple and straight way to do it in Java And SWT)
display.syncExec (new Runnable () {
public void run () {
if (!myWindow.isDisposed())
myWindow.redraw ();
}
Anything similar for MFC and windows in general?
Upvotes: 0
Views: 627
Reputation: 1974
You can use PostThreadMessage WinAPI function to send WM_USER
message to main thread. Then you can handle WM_USER
in main thread and do some necessary actions.
Upvotes: 1