Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CPropertySheet::Create

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

Parameters

pParentWnd
Points to parent window. If NULL, parent is the desktop.
dwStyle
Specifies the Window styles for property sheet. For a complete list of available styles, see Window Styles.
dwExStyle
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.

Remarks

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.

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

Requirements

  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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.