I have a derive class named A was inheritance from CDialog, I created the object to A named a and want to utilize the member function domodal to show dialog. Nonetheless, this dialog cannot show and parent window was block.
A a(this);
auto DlgResult = std::async(std::launch::async, &A::DoModal,&a);
DlgResult.wait();
if (DlgResult.get() == IDOK)
{
std::wstring ss = a.get_text_fromdlg();
}
Can someone help me, thanks!
If I were you, I wouldn't wrestle w/ the Async and DoModal since the purpose of DoModal() is to wait for the response from the dialog to let the app know how to move forward..
Below, I've added a simpler option. Just create member variable pointer to a Dialog class, and then use Show Window. Also, in this instance, you may consider making the dialog topmost so you don't lose focus of it.