Shangwu
Tue Oct 28 08:56:08 CST 2003
Thank you for your feedback.
Here is the sample code to show a dialog. The dialog class could be
anything.
===================================
BOOL CTdlgApp::InitInstance()
{
CDlg dlg;
dlg.m_bFullScreen = FALSE;
if (dlg.DoModal() != IDOK)
return FALSE;
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CTdlgDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CTdlgView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
=====================================
"Alexander Shargin" <alex@rsdn.ru> wrote in message
news:eKvY3OSnDHA.2268@TK2MSFTNGP12.phx.gbl...
>
> If main window is already created when the dialog is displayed, you should
> assign it as dialog's owner. To do this, pass a pointe to main window
object
> to dialog's constructor.
>
> If this is not the case, please show us some code.
>
> --
> Alexander Shargin
> Microsoft MVP in Mobile Devices
>
> mailto:alex@rsdn.ru
>
http://www.rsdn.ru - Russian Software Developer Network
>
http://www.pocketpcdn.com - Pocket PC Developer Network
>
>
> "Shangwu" <sqisoft@coxDOTnet> wrote in message
> news:OD$jG7LnDHA.2272@tk2msftngp13.phx.gbl...
> > Hello,
> >
> > I created an application with MFC's Doc/View structure on Pocket PC
2002.
> In
> > InitInstance of CWinApp derived Class, I putted code to show a Modal
> dialog
> > box before other initailization. If the user click OK, the program will
> > continue to run. Otherwise the InitInstance will returns FALSE to stop
the
> > program.
> > The problem is that after the dialog box returns IDOK, the program is
> still
> > running, but the main window is hidden in background. Do I implement
this
> in
> > wrong way? I can move this code to OnNewDocument of CMyDocument or
> somewhere
> > else. I am wondering why the main window will be hidden after a dialog
box
> > displayed.
> >
> > Thanks,
> >
> > Shangwu
> >
> >
>
>