Opening dialog from non-message thread

I am using an bcf2000 control surface using midi to control the Mix application I am working on.  On my main dialog I have a button that opens another dialog.  I want to be able to make this happen from the press of the button on the midi controller.  In the callback of the midi input I tried to open the dialog but I get an assert indicating I cannot set the title in a non-message thread.  (On windows).


Instead of doing it this way is seems like from the midi callback thread I should  be able to create a message telling the main dialog to press the button.  Can this be done and if so, how?




I think I figured it out using MessageManager::callFunctionOnMessageThread. 

Take a look at the Message and CallbackMessage classes.


[edit]  You posted while I was posting.  callFunctionOnMessageThread() may not be what you need as it is blocking.  Your MIDI thread is going to come to a total halt until that function returns.