2nd Dialog never appears in Dialog based app 
Author Message
 2nd Dialog never appears in Dialog based app

Within my CDialog based app, in CMyApp::InitIntance() I am attempting to:

1 - display  primary dialog1
2 - evalute return value (IDCANCEL or IDOK)
3 - Display another CDialog based window  (dialog2)
4 - Call CMyApp::ExitInstance()

Step 3 FAILS without ever displaying the window.

Step 3 involes:
Instantiating the instance...

     CDialog2 Dialog2 ;

and then calling Dialog2.DoModal()  ;

The DoModal returns immediately without ever displaying the dialog.  In the
debug, no ASSERTS are thrown.  The Dialog2 resource attributes are defined
in the resource file (.rc) and resource.h.
The Resources compile to the .res file without any problems.  I ensured that
the CDialog2 definition uses the correct resourceID.  You should know that
the hwnd member of CDialog2 is set to NULL when run in the de{*filter*}.  What's
going on here?  Do I need to:

    Instantiate CDialog2 from with the previous Dialog1's OnOK() member?
    reset the CMyApp->m_pMainWnd to Dialog2?
    directly call CreateWindow with the Dialog2 parameters?

-Apex



Fri, 24 Oct 2003 23:17:32 GMT  
 2nd Dialog never appears in Dialog based app
Apex,

This is a rather common problem.  Have a look at the MSDN article Q138681 -
I think it will explain what's happening and what to do to correct it..

regards
roy fine...


Quote:
> Within my CDialog based app, in CMyApp::InitIntance() I am attempting to:

> 1 - display  primary dialog1
> 2 - evalute return value (IDCANCEL or IDOK)
> 3 - Display another CDialog based window  (dialog2)
> 4 - Call CMyApp::ExitInstance()

> Step 3 FAILS without ever displaying the window.

> Step 3 involes:
> Instantiating the instance...

>      CDialog2 Dialog2 ;

> and then calling Dialog2.DoModal()  ;

> The DoModal returns immediately without ever displaying the dialog.  In
the
> debug, no ASSERTS are thrown.  The Dialog2 resource attributes are defined
> in the resource file (.rc) and resource.h.
> The Resources compile to the .res file without any problems.  I ensured
that
> the CDialog2 definition uses the correct resourceID.  You should know that
> the hwnd member of CDialog2 is set to NULL when run in the de{*filter*}.
What's
> going on here?  Do I need to:

>     Instantiate CDialog2 from with the previous Dialog1's OnOK() member?
>     reset the CMyApp->m_pMainWnd to Dialog2?
>     directly call CreateWindow with the Dialog2 parameters?

> -Apex



Sat, 25 Oct 2003 01:00:15 GMT  
 2nd Dialog never appears in Dialog based app
Prior to calling Dlg1.DoModal(), are you setting m_pMainWnd = &Dlg1?  If so,
comment that line out.  Did that work?  If so, read
http://www.*-*-*.com/


Quote:
> Within my CDialog based app, in CMyApp::InitIntance() I am attempting to:

> 1 - display  primary dialog1
> 2 - evalute return value (IDCANCEL or IDOK)
> 3 - Display another CDialog based window  (dialog2)
> 4 - Call CMyApp::ExitInstance()

> Step 3 FAILS without ever displaying the window.

> Step 3 involes:
> Instantiating the instance...

>      CDialog2 Dialog2 ;

> and then calling Dialog2.DoModal()  ;

> The DoModal returns immediately without ever displaying the dialog.  In
the
> debug, no ASSERTS are thrown.  The Dialog2 resource attributes are defined
> in the resource file (.rc) and resource.h.
> The Resources compile to the .res file without any problems.  I ensured
that
> the CDialog2 definition uses the correct resourceID.  You should know that
> the hwnd member of CDialog2 is set to NULL when run in the de{*filter*}.
What's
> going on here?  Do I need to:

>     Instantiate CDialog2 from with the previous Dialog1's OnOK() member?
>     reset the CMyApp->m_pMainWnd to Dialog2?
>     directly call CreateWindow with the Dialog2 parameters?

> -Apex



Sat, 25 Oct 2003 01:00:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CStrings allocated in Dialog based app appear to be static

2. Modeless dialog in a dialog-based app

3. dialog within dialog based apps

4. Showing taskbar visible dialog from dialog based app

5. Dialog-based app and modal dialog

6. HOWTO: hide dialog when a dialog-based app starts

7. dialog based app making modeless dialogs

8. PBM: Message box not displayed after main dialog box is closed in MFC dialog-based app

9. Dialog-Based App and Main Dialog Problem

10. Destroy Dialog for Dialog based app

11. Resizing a dialog based app based on its view's size

12. Internal Compiler Error C1001 (in VC++) when compiling a Dialog based App

 

 
Powered by phpBB® Forum Software