If you need a start dialog that is shown before your main dialog, just show this dialog from within
InitInstance()
and return upon Cancel:
BOOL CMyApp::InitInstance()
{
CStartDlg StartDlg;
if (StartDlg.DoModal() == IDCANCEL)
return FALSE;
CMainDlg MainDlg;
m_pMainWnd = &MainDlg;
MainDlg.DoModal();
return FALSE;
}
If you need to pass some data between the start dialog and your application, you can pass a pointer to your
CMyApp
class.
[EDIT: Added example to show how data can be passed]
BOOL CMyApp::InitInstance()
{
CMainDlg MainDlg;
m_pMainWnd = &MainDlg;
CStartDlg StartDlg;
if (StartDlg.DoModal() == IDCANCEL)
return FALSE;
MainDlg.DoModal();
return FALSE;
}
void CStartDlg::OnOK()
{
CMainDlg* pMainDlg = static_cast<CMainDlg*>(AfxGetApp()->m_pMainWnd);
CDialog::OnOK();
}