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...