Поделиться через


CDialog::CDialog

To construct a resource-based modal dialog box, call either public form of the constructor.

explicit CDialog(
   LPCTSTR lpszTemplateName,
   CWnd* pParentWnd = NULL 
);
explicit CDialog(
   UINT nIDTemplate,
   CWnd* pParentWnd = NULL 
);
CDialog( );

Parameters

  • lpszTemplateName
    Contains a null-terminated string that is the name of a dialog-box template resource.

  • nIDTemplate
    Contains the ID number of a dialog-box template resource.

  • pParentWnd
    Points to the parent or owner window object (of type CWnd) to which the dialog object belongs. If it is NULL, the dialog object's parent window is set to the main application window.

Remarks

One form of the constructor provides access to the dialog resource by template name. The other constructor provides access by template ID number, usually with an IDD_ prefix (for example, IDD_DIALOG1).

To construct a modal dialog box from a template in memory, first invoke the parameterless, protected constructor and then call InitModalIndirect.

After you construct a modal dialog box with one of the above methods, call DoModal.

To construct a modeless dialog box, use the protected form of the CDialog constructor. The constructor is protected because you must derive your own dialog-box class to implement a modeless dialog box. Construction of a modeless dialog box is a two-step process. First call the constructor; then call the Create member function to create a resource-based dialog box, or call CreateIndirect to create the dialog box from a template in memory.

Requirements

Header: afxwin.h

See Also

Reference

CDialog Class

Hierarchy Chart

CDialog::Create

CWnd::DestroyWindow

CDialog::InitModalIndirect

CDialog::DoModal

CreateDialog

Other Resources

CDialog Members