How to create a modeless dialog box under MFC.

How to create a modeless dialog box under MFC.

Post by Pradeep K Tapadi » Thu, 06 Jul 1995 04:00:00



Howdy netters,

I am using VC2.1 and have created a dialog box (using AppStudio)
and its corresponding class (using ClassWizard).

To create a modal dialog box seems pretty easy:

  CMyTestDlg dlg;

  if (dlg.DoModal () != MB_OK)
     return;
  ...

How can I display CMyTestDlg as modeless? Books Online talks about
using CreateIndirect MFC API. To my understanding, CreateIndirect
works only with a resource name. How can I associate CMyTestDlg with
CreateIndirect?

Thank you for your help.

Pradeep

 
 
 

How to create a modeless dialog box under MFC.

Post by David R. Conn » Thu, 06 Jul 1995 04:00:00




Quote:>Howdy netters,

>I am using VC2.1 and have created a dialog box (using AppStudio)
>and its corresponding class (using ClassWizard).

>To create a modal dialog box seems pretty easy:

>  CMyTestDlg dlg;

>  if (dlg.DoModal () != MB_OK)
>     return;
>  ...

>How can I display CMyTestDlg as modeless? Books Online talks about
>using CreateIndirect MFC API. To my understanding, CreateIndirect
>works only with a resource name. How can I associate CMyTestDlg with
>CreateIndirect?

>Thank you for your help.

>Pradeep

To change it to modeless, replace DoModal() with Create().  That's it.  (But
be careful of your scoping!)

(Actually, not quite it...  You need to change your contructor.  Remove the
one in there now, and create one that takes no parameters.  The default
contructor is protected.  Since I have some modeless dialog objects that may
exist when the dialog doesn't, I added a flag that keeps the state that gets
set in the overridden Create and OnDestroy members.  Though I could have
called IsWindow also.  I also added a Create member that takes only the parent
window.  My Create then calls CDialog::Create(MyDialog::IDD, pParent).)

Dave

--------------------
Is my project done?  Define done...




 
 
 

1. Calling a modeless dialog box from a modal dialog box

Hi,

Can a modal dialog box be the parent of a modeless dialog box?

I have a dialog box with 7 radio buttons.  Depending on which
button is selected, a different modeless dialog box is displayed.
The user will select a control on the modeless dialog box and then
both the modal and modeless dialog boxes should go away.

I am using VC++ and MFC.

Any help would be appreciated.

Cathy

2. Wanted : Platinum Apple 5.25 drive

3. (MFC) Q:Modeless Dialog Boxes

4. UK : Which stores stock FS98?

5. How to make a modeless dialog box using MFC?

6. Sparc 1E motherboarded needed

7. And how do YOU create a Modeless Dialog Box over a SDI app?

8. Help! looking for programs in "c"

9. VC++ - Threads creating modeless dialog boxes

10. How do I create Modeless Dialog boxes?

11. creating modeless dialog box

12. Modeless dialog out of a Modal dialog box: possible?

13. Modeless Dialog in another modeless Dialog