Reputation: 51
My MFC application is a MDI application. and I have a MFC Extension dll, MFC Extension dll will launch the child dialog on top of the MFC MDI application. like as below
CMyDialog pDisplayGlobal = new CMyDialog(IDD_DISPLAY, NULL);
pDisplayGlobal->Create(IDD_DISPLAY, AfxGetApp()->m_pMainWnd);
pDisplayGlobal->ShowWindow(SW_NORMAL);
Note : Kindly let me know if I am doing anything wrong in above code.
Problem: I have launched my MFC mdi application and child modeless dialog as well. Modeless dialog always on top of parent window only (as per the above code)
Step1) I have opened other four different applications (Which means my MFC application is behind these four applications)
Step2) I clicked on my MFC application from the Taskbar it’s not showing the main application window. which means it didnt come in front its still in step1 stage only
Step3) To see My MFC application I have to minimize all the four applications
That’s the problem, kindly somebody give me some code snippet as a solution.
Thanks in advance.
Upvotes: 0
Views: 230
Reputation: 31679
To run a dialog from another program you can do the following
in DLL:
CDialog *g_dlg;
void dll_foo()
{
g_dlg = new CDialog;
g_dlg->Create(IDD_DIALOG1);
g_dlg->ShowWindow(SW_SHOWNORMAL);
}
in main app:
BOOL CMyWinApp::InitInstance()
{
//...
frame->ShowWindow(SW_SHOWNORMAL);
frame->UpdateWindow();
dll_foo();
return TRUE;
}
Upvotes: 0