I have a Main Thread that displays an interface, within another thread created from the main thread before the Main interface is shown, I create tow other windows sequentially:
The problem you seem to have, from your description at least, is that whatever external API you are using via CreateAnObject
, it restricts its further use to creation thread. Taking it as is, you are limited to making calls from the creation thread only. Whenever your code running on other theads, including thread hosting CWarningDlg
, needs to talk to this API, you need to transfer the call to the CActionDlg
thread and proceed from there.
Synchronization can be SendMessage
you already do, or something safer like PostMessage
with event/message completion notification.