I have a Multiple document application.
From a menu / toolbar I open a Modal Dialog.
From this Modal Dialog , I open a Self Closing Modeless dialog.
Self Closing Modeless dialog : When the dialog is made inactive : handle WA_INACTIVE message : then I call DestroyWindow().
Thus the Modeless dialog gets auto destroyed.
After this focus does not again go in my Modal Dialog.
But, I observed that Active Window gets switched to another Window open in Windows.
I tried:
After destroying Self Closing Modeless dialog, I tried activating my Application window using AfxGetMainWnd.
CWnd* pMainWnd = AfxGetMainWnd();
pMainWnd->SetActiveWindow();
This helped me to avoid switching. But I am facing another issue is that My Modal Dialog is not in focus.
I tried setting Focus with SetFocus() method. But its of no use.
Please help me how can I activate & have focus in my Modal Dialog after auto destroying Modeless dialog.
I tried creating Self Closing Modeless dialog with
this->Create(MWPartImageOrientationDlg::IDD, pParent);
where pParent is the Modal Dialog.
I even tried
this->Create(MWPartImageOrientationDlg::IDD, AfxGetMainWnd());
But no benefit.