MSDN Library


This method displays a modeless property sheet. You can call Create from inside the constructor, or you can call it after the constructor is invoked.

BOOL Create(
CWnd* pParentWnd = NULL,
DWORD dwStyle = (DWORD)–1,
DWORD dwExStyle = 0 ); 


Points to parent window. If NULL, parent is the desktop.
Specifies the Window styles for property sheet. For a complete list of available styles, see Window Styles.
Specifies the Extended window styles for property sheet. For a complete list of available styles, see Extended Window Styles.

Return Value

Nonzero if the property sheet is created successfully; otherwise, it is zero.


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 method 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 CPropertySheet::DoModal instead.


// 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");

  // 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;

  // Create a modeless CPropertySheet dialog.

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

  if (m_dlgPropertySheet)
    delete m_stylePage;
    delete m_colorPage;
    delete m_dlgPropertySheet;


  Windows CE versions: 1.0 and later  
  Header file: Declared in Afxdlgs.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also

CDialog::Create, CPropertySheet::DoModal

© 2016 Microsoft