Share via


CPropertySheet::Create

BOOLCreate(CWnd*pParentWnd=NULL,DWORDdwStyle**=(DWORD)–1,DWORDdwExStyle=0);**

Return Value

Nonzero if the property sheet is created successfully; otherwise 0.

Parameters

pParentWnd

Points to parent window. If NULL, parent is the desktop.

dwStyle

Window styles for property sheet. For a complete list of available styles, see Window Styles.

dwExStyle

Extended window styles for property sheet. For a complete list of available styles, see Extended Window Styles

Remarks

Call this member function to display a modeless property sheet. The call to Create can be inside the constructor, or you can call it after the constructor is invoked.

The default style, expressed by passing –1 as dwStyle, is actually WS_SYSMENU|WS_POPUP|WS_CAPTION|DS_MODALFRAME|DS_CONTEXT_HELP|WS_VISIBLE. The default extended window style, expressed by passing 0 as dwExStyle, is actually WS_EX_DLGMODALFRAME.

The Create member function returns immediately after creating the property sheet. To destroy the property sheet, call CWnd::DestroyWindow.

Modeless property sheets displayed with a call to Create do not have OK, Cancel, Apply Now, and Help buttons as modal property sheets do. Desired buttons must be created by the user.

To display a modal property sheet, call DoModal instead.

Example

// This code fragment shows how to create a modeless property sheet
// dialog in a command message handler (OnModelessPropertySheet())
// of a CView-derived class.

void CMyView::OnModelessPropertySheet()
{
   // Declare a CPropertySheet object.  m_dlgPropertySheet is a data
   // member of type CPropertySheet in CView-derived class.
   m_dlgPropertySheet = new CPropertySheet("Simple PropertySheet");
   ASSERT(m_dlgPropertySheet);

   // Add two pages to the CPropertySheet object.  Both m_stylePage and
   // m_colorPage are data members of type CPropertyPage-derived classes
   // in CView-derived class.
   m_stylePage = new CStylePage;
   m_colorPage = new CColorPage;
   m_dlgPropertySheet->AddPage(m_stylePage);
   m_dlgPropertySheet->AddPage(m_colorPage);

   // Create a modeless CPropertySheet dialog.
   m_dlgPropertySheet->Create();
}

// The code fragment below shows how to destroy the C++ objects for
// propertysheet and propertypage in the destructor of CView-derived
// class.
// NOTE:  DestroyWindow() is called in CPropertySheet::OnClose() so
// you do not need to call it here.  Property pages are children
// of the CPropertySheet, they will be destroyed by their parents.

CMyView::~CMyView()
{
   if (m_dlgPropertySheet)
   {
      delete m_stylePage;
      delete m_colorPage;
      delete m_dlgPropertySheet;
   }
}

CPropertySheet OverviewClass MembersHierarchy Chart

See Also   CDialog::Create, CPropertySheet::DoModal