Редактиране

Споделяне чрез


CPropertyPage Class

Represents individual pages of a property sheet, otherwise known as a tab dialog box.

Syntax

class CPropertyPage : public CDialog

Members

Public Constructors

Name Description
CPropertyPage::CPropertyPage Constructs a CPropertyPage object.

Public Methods

Name Description
CPropertyPage::CancelToClose Changes the OK button to read Close, and disables the Cancel button, after an unrecoverable change in the page of a modal property sheet.
CPropertyPage::Construct Constructs a CPropertyPage object. Use Construct if you want to specify your parameters at run time, or if you're using arrays.
CPropertyPage::GetPSP Retrieves the Windows PROPSHEETPAGE structure associated with the CPropertyPage object.
CPropertyPage::OnApply Called by the framework when the Apply Now button is clicked.
CPropertyPage::OnCancel Called by the framework when the Cancel button is clicked.
CPropertyPage::OnKillActive Called by the framework when the current page is no longer the active page. Perform data validation here.
CPropertyPage::OnOK Called by the framework when the OK, Apply Now, or Close button is clicked.
CPropertyPage::OnQueryCancel Called by the framework when the Cancel button is clicked, and before the cancel has taken place.
CPropertyPage::OnReset Called by the framework when the Cancel button is clicked.
CPropertyPage::OnSetActive Called by the framework when the page is made the active page.
CPropertyPage::OnWizardBack Called by the framework when the Back button is clicked while using a wizard-type property sheet.
CPropertyPage::OnWizardFinish Called by the framework when the Finish button is clicked while using a wizard-type property sheet.
CPropertyPage::OnWizardNext Called by the framework when the Next button is clicked while using a wizard-type property sheet.
CPropertyPage::QuerySiblings Forwards the message to each page of the property sheet.
CPropertyPage::SetModified Call to activate or deactivate the Apply Now button.

Public Data Members

Name Description
CPropertyPage::m_psp The Windows PROPSHEETPAGE structure. Provides access to basic property page parameters.

Remarks

As with standard dialog boxes, you derive a class from CPropertyPage for each page in your property sheet. To use CPropertyPage-derived objects, first create a CPropertySheet object, and then create an object for each page that goes in the property sheet. Call CPropertySheet::AddPage for each page in the sheet, and then display the property sheet by calling CPropertySheet::DoModal for a modal property sheet, or CPropertySheet::Create for a modeless property sheet.

You can create a type of tab dialog box called a wizard, which consists of a property sheet with a sequence of property pages that guide the user through the steps of an operation, such as setting up a device or creating a newsletter. In a wizard-type tab dialog box, the property pages don't have tabs, and only one property page is visible at a time. Also, instead of having OK and Apply Now buttons, a wizard-type tab dialog box has a Back button, a Next or Finish button, and a Cancel button.

For more information on establishing a property sheet as a wizard, see CPropertySheet::SetWizardMode. For more information on using CPropertyPage objects, see the article Property Sheets and Property Pages.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CDialog

CPropertyPage

Requirements

Header: afxdlgs.h

CPropertyPage::CancelToClose

Call this function after an unrecoverable change has been made to the data in a page of a modal property sheet.

void CancelToClose();

Remarks

This function will change the OK button to Close and disable the Cancel button. This change alerts the user that a change is permanent and the modifications can't be canceled.

The CancelToClose member function does nothing in a modeless property sheet, because a modeless property sheet doesn't have a Cancel button by default.

Example

See the example for CPropertyPage::QuerySiblings.

CPropertyPage::Construct

Call this member function to construct a CPropertyPage object.

void Construct(
    UINT nIDTemplate,
    UINT nIDCaption = 0);

void Construct(
    LPCTSTR lpszTemplateName,
    UINT nIDCaption = 0);

void Construct(
    UINT nIDTemplate,
    UINT nIDCaption,
    UINT nIDHeaderTitle,
    UINT nIDHeaderSubTitle = 0);

void Construct(
    LPCTSTR lpszTemplateName,
    UINT nIDCaption,
    UINT nIDHeaderTitle,
    UINT nIDHeaderSubTitle = 0);

Parameters

nIDTemplate
ID of the template used for this page.

nIDCaption
ID of the name to be placed in the tab for this page. If 0, the name will be taken from the dialog template for this page.

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

nIDHeaderTitle
ID of the name to be placed in the title location of the property page header. By default, 0.

nIDHeaderSubTitle
ID of the name to be placed in the subtitle location of the property page header. By default, 0.

Remarks

The object is displayed after all of the following conditions are met:

  • The page has been added to a property sheet using CPropertySheet::AddPage.

  • The property sheet's DoModal or Create function has been called.

  • The user has selected (tabbed to) this page.

Call Construct if one of the other class constructors hasn't been called. The Construct member function is flexible because you can leave the parameter statement blank and then specify multiple parameters and construction at any point in your code.

You must use Construct when you work with arrays, and you must call Construct for each member of the array so that the data members are assigned proper values.

Example

// Declare a CPropertySheet object.
CPropertySheet sheet(_T("Simple PropertySheet"));

// Create three CPropertyPage objects whose template IDs are specified
// in rgID array, and add each page to the CPropertySheet object. 
const int c_cPages = 3;
CPropertyPage   pages[c_cPages];
UINT rgID[c_cPages] = { IDD_STYLE, IDD_COLOR, IDD_SHAPE };
for (int i = 0; i < c_cPages; i++)
{
   pages[i].Construct(rgID[i]);
   sheet.AddPage(&pages[i]);
}

// Display a modal CPropertySheet dialog.
sheet.DoModal();

CPropertyPage::CPropertyPage

Constructs a CPropertyPage object.

CPropertyPage();

explicit CPropertyPage(
    UINT nIDTemplate,
    UINT nIDCaption = 0,
    DWORD dwSize = sizeof(PROPSHEETPAGE));

explicit CPropertyPage(
    LPCTSTR lpszTemplateName,
    UINT nIDCaption = 0,
    DWORD dwSize = sizeof(PROPSHEETPAGE));

CPropertyPage(
    UINT nIDTemplate,
    UINT nIDCaption,
    UINT nIDHeaderTitle,
    UINT nIDHeaderSubTitle = 0,
    DWORD dwSize = sizeof(PROPSHEETPAGE));

CPropertyPage(
    LPCTSTR lpszTemplateName,
    UINT nIDCaption,
    UINT nIDHeaderTitle,
    UINT nIDHeaderSubTitle = 0,
    DWORD dwSize = sizeof(PROPSHEETPAGE));

Parameters

nIDTemplate
ID of the template used for this page.

nIDCaption
ID of the name to be placed in the tab for this page. If 0, the name will be taken from the dialog template for this page.

dwSize
lpszTemplateName Points to a string containing the name of the template for this page. Can't be NULL.

nIDHeaderTitle
ID of the name to be placed in the title location of the property page header.

nIDHeaderSubTitle
ID of the name to be placed in the subtitle location of the property page header.

Remarks

The object is displayed after all of the following conditions are met:

  • The page has been added to a property sheet using CPropertySheet::AddPage.

  • The property sheet's DoModal or Create function has been called.

  • The user has selected (tabbed to) this page.

If you have multiple parameters (for example, if you're using an array), use CPropertySheet::Construct instead of CPropertyPage.

Example

// Declare a CStylePage object, which is a CPropertyPage-derived class.
CStylePage stylePage;

// Declare a CPropertyPage object with IDD_SHAPE, the ID of the 
// template used for this page. 
CPropertyPage shapePage(IDD_SHAPE);

CPropertyPage::GetPSP

Retrieves the Windows PROPSHEETPAGE structure associated with the CPropertyPage object.

const PROPSHEETPAGE& GetPSP() const;

PROPSHEETPAGE& GetPSP();

Return Value

A reference to the PROPSHEETPAGE structure.

CPropertyPage::m_psp

m_psp is a structure whose members store the characteristics of PROPSHEETPAGE.

PROPSHEETPAGE m_psp;

Remarks

Use this structure to initialize the appearance of a property page after it's constructed.

For more information on this structure, including a listing of its members, see PROPSHEETPAGE in the Windows SDK.

Example

CPropertySheet sheet(_T("Simple PropertySheet"));

// Change the settings of the three pages to enable property sheet's 
// Help button when the page is active.  CStylePage, CShapePage, and 
// CColorPage are CPropertyPage-derived classes.
CStylePage pageStyle;
pageStyle.m_psp.dwFlags |= PSP_HASHELP;

CColorPage pageColor;
pageColor.m_psp.dwFlags |= PSP_HASHELP;

CShapePage pageShape;
pageShape.m_psp.dwFlags |= PSP_HASHELP;

sheet.AddPage(&pageStyle);
sheet.AddPage(&pageColor);
sheet.AddPage(&pageShape);

sheet.SetWizardMode();

sheet.DoModal();

CPropertyPage::OnApply

This member function is called by the framework when the user chooses the OK or the Apply Now button.

virtual BOOL OnApply();

Return Value

Nonzero if the changes are accepted; otherwise 0.

Remarks

When the framework calls this function, changes made on all property pages in the property sheet are accepted, the property sheet retains focus, and OnApply returns TRUE (the value 1). Before OnApply can be called by the framework, you must have called SetModified and set its parameter to TRUE. This will activate the Apply Now button as soon as the user makes a change on the property page.

Override this member function to specify what action your program takes when the user selects the Apply Now button. When overriding, the function should return TRUE to accept changes and FALSE to prevent changes from taking effect.

The default implementation of OnApply calls OnOK.

For more information about notification messages sent when the user presses the Apply Now or OK button in a property sheet, see PSN_APPLY in the Windows SDK.

Example

See the example for CPropertyPage::OnOK.

CPropertyPage::OnCancel

This member function is called by the framework when the Cancel button is selected.

virtual void OnCancel();

Remarks

Override this member function to perform Cancel button actions. The default negates any changes that have been made.

Example

// Discard any selection the user made to this page.  The object
// in the view will be painted with the initial color when the
// CPropertySheet dialog is first shown. CColorPage is a 
// CPropertyPage-derived class.
void CColorPage::OnCancel()
{
   // Reset the color saved in the document class.  m_InitialColor
   // is a member variable of CColorPage and it is the color shown 
   // in the view before CPropertySheet is shown.
   // doc->m_Color is the color saved in the document class, and 
   // this is the color to be used by the view class.
   CMDIFrameWnd* pFrame = (CMDIFrameWnd*)AfxGetMainWnd();
   CMDIChildWnd* pChild = pFrame->MDIGetActive();
   CPSheetDoc* doc = (CPSheetDoc*)pChild->GetActiveDocument();
   doc->m_Color = m_InitialColor;

   // Tell the view to paint with the initial color.
   CView* view = pChild->GetActiveView();
   view->Invalidate();

   CPropertyPage::OnCancel();
}

// The default MFC implementation of OnReset() would call OnCancel().
void CColorPage::OnReset()
{
   CPropertyPage::OnReset();
}

CPropertyPage::OnKillActive

This member function is called by the framework when the page is no longer the active page.

virtual BOOL OnKillActive();

Return Value

Nonzero if data was updated successfully, otherwise 0.

Remarks

Override this member function to perform special data validation tasks.

The default implementation of this member function copies settings from the controls in the property page to the member variables of the property page. If the data wasn't updated successfully due to a dialog data validation (DDV) error, the page retains focus.

After this member function returns successfully, the framework will call the page's OnOK function.

Example

// Validate the value entered to the "Number" edit control. Its
// value must be at least one. If not, tell the user and set the
// focus to the "Number" edit control. CStylePage is a 
// CPropertyPage-derived class.
BOOL CStylePage::OnKillActive() 
{
   int num = GetDlgItemInt(IDC_NUMOBJECTS);
   if (num <= 0)
   {
      AfxMessageBox(_T("Number of objects must be at least 1."));
      CEdit* edit = (CEdit*) GetDlgItem(IDC_NUMOBJECTS);
      edit->SetFocus();
      edit->SetSel(0, -1);
      return 0;
   }

   return CPropertyPage::OnKillActive();
}

CPropertyPage::OnOK

This member function is called by the framework when the user chooses either the OK or the Apply Now button, immediately after the framework calls OnKillActive.

virtual void OnOK();

Remarks

When the user chooses either the OK or the Apply Now button, the framework receives the PSN_APPLY notification from the property page. The call to OnOK won't be made if you call CPropertySheet::PressButton because the property page doesn't send the notification in that case.

Override this member function to implement additional behavior specific to the currently active page when user dismisses the entire property sheet.

The default implementation of this member function marks the page as "clean" to reflect that the data was updated in the OnKillActive function.

Example

// Accept the new color selection and dismiss the CPropertySheet
// dialog. The view's object will be painted with the new selected
// color. CColorPage is a CPropertyPage-derived class.
void CColorPage::OnOK() 
{
   // Store the new selected color to a member variable of 
   // document class.  m_Color is a member varible of CColorPage 
   // and it stores the new selected color.  doc->m_Color is 
   // the color saved in the document class and it is the color 
   // used by the view class.
   CMDIFrameWnd* pframe = (CMDIFrameWnd*) AfxGetMainWnd();
   CMDIChildWnd* pchild = pframe->MDIGetActive();
   CPSheetDoc* doc = (CPSheetDoc*) pchild->GetActiveDocument();
   doc->m_Color = m_Color;

   // Tell the view to paint with the new selected color.
   CView* view = pchild->GetActiveView();
   view->Invalidate();
  
   CPropertyPage::OnOK();
}

// The default MFC implementation of OnApply() would call OnOK().
BOOL CColorPage::OnApply() 
{
   return CPropertyPage::OnApply();
}

CPropertyPage::OnQueryCancel

This member function is called by the framework when the user selects the Cancel button and before the cancel action has taken place.

virtual BOOL OnQueryCancel();

Return Value

Returns FALSE to prevent the cancel operation or TRUE to allow it.

Remarks

Override this member function to specify an action the program takes when the user selects the Cancel button.

The default implementation of OnQueryCancel returns TRUE.

Example

// Query the user whether to abort the changes if the new selected
// color (m_Color) is different from the initial color 
// (m_InitialColor) when the CPropertySheet dialog is first shown.
// CColorPage is a CPropertyPage-derived class.
BOOL CColorPage::OnQueryCancel() 
{
   if (m_InitialColor != m_Color)
   {
      if (AfxMessageBox(_T("Abort the changes?"), MB_YESNO) == IDNO)
         return FALSE;  
   }

   return CPropertyPage::OnQueryCancel();
}

CPropertyPage::OnReset

This member function is called by the framework when the user chooses the Cancel button.

virtual void OnReset();

Remarks

When the framework calls this function, changes to all property pages that were made by the user previously choosing the Apply Now button are discarded, and the property sheet retains focus.

Override this member function to specify what action the program takes when the user selects the Cancel button.

The default implementation of OnReset does nothing.

Example

See the example for CPropertyPage::OnCancel.

CPropertyPage::OnSetActive

This member function is called by the framework when the page is chosen by the user and becomes the active page.

virtual BOOL OnSetActive();

Return Value

Nonzero if the page was successfully set active; otherwise 0.

Remarks

Override this member function to perform tasks when a page is activated. Your override of this member function would typically call the default version after updating data members, to allow it to update the page controls with the new data.

The default implementation creates the window for the page, if not previously created, and makes it the active page.

Example

See the example for CPropertySheet::SetFinishText.

CPropertyPage::OnWizardBack

This member function is called by the framework when the user selects the Back button in a wizard.

virtual LRESULT OnWizardBack();

Return Value

0 to automatically advance to the next page; -1 to prevent the page from changing. To jump to a page other than the next one, return the identifier of the dialog to be displayed.

Remarks

Override this member function to specify some action the user must take when the Back button is pressed.

For more information on how to make a wizard-type property sheet, see CPropertySheet::SetWizardMode.

Example

// The Back button is selected from the propertysheet.  Get the selected 
// radio button of the page by looping through all buttons on the 
// pages.  m_radioColor is a member variable of 
// CColorPage (a CPropertyPage-derived class).  Its initial value 
// is initialized in OnInitDialog().
LRESULT CColorPage::OnWizardBack()
{
   for (int id = IDC_RADIOBLACK; id <= IDC_RADIOGREEN; id++)
   {
      CButton* button = (CButton*)GetDlgItem(id);
      if (button->GetCheck() == 1)
      {
         m_radioColor = id - IDC_RADIOBLACK;
         break;
      }
   }

   return CPropertyPage::OnWizardBack();
}

CPropertyPage::OnWizardFinish

This member function is called by the framework when the user selects the Finish button in a wizard.

virtual BOOL OnWizardFinish();

Return Value

Nonzero if the property sheet is destroyed when the wizard finishes; otherwise zero.

Remarks

When a user selects the Finish button in a wizard, the framework calls this function; when OnWizardFinish returns TRUE (a nonzero value), the property sheet is able to be destroyed (but isn't actually destroyed). Call DestroyWindow to destroy the property sheet. Don't call DestroyWindow from OnWizardFinish; doing so will cause heap corruption or other errors.

You can override this member function to specify some action the user must take when the Finish button is pressed. When overriding this function, return FALSE to prevent the property sheet from being destroyed.

For more information about notification messages sent when the user presses the Finish button in a wizard property sheet, see PSN_WIZFINISH in the Windows SDK.

For more information on how to make a wizard-type property sheet, see CPropertySheet::SetWizardMode.

Example

// Inform users regarding the selections they have made by 
// navigating the pages in propertysheet.
BOOL CShapePage::OnWizardFinish()
{
   CString report = _T("You have selected the following options:\n");

   // Get the number of property pages from CPropertySheet.
   CPropertySheet* sheet = (CPropertySheet*)GetParent();
   int count = sheet->GetPageCount();

   // Get the formatted string from each page. This formatted string 
   // will be shown in a message box. Each page knows about the 
   // string to be displayed. For simplicity, we derive a class 
   // from CPropertyPage called CMyPropertyPage. CMyPropertyPage 
   // has a pure virtual member function called GetPageSelections().
   // All pages in the property sheet must be derived from 
   // CMyPropertyPage so we loop through each page to get the 
   // formatted string by calling the GetPageSelections() function.
   for (int i = 0; i < count; i++)
   {
      CMyPropertyPage* page = (CMyPropertyPage*)sheet->GetPage(i);

      CString str;
      page->GetPageSelections(str);
      report += _T("\n") + str;
   }

   AfxMessageBox(report);

   return CPropertyPage::OnWizardFinish();
}

 

// An example of implementing the GetPageSelections() for CStylePage.
// CStylePage is a CMyPropertyPage-derived class, which in turn is a 
// CPropertyPage-derived class.
void CStylePage::GetPageSelections(CString& str)
{
   str.Format(_T("Number of objects to be created = %d"), m_NumObjects);
}

 

// An example of implementing the GetPageSelections() for CColorPage.
// CColorPage is a CMyPropertyPage-derived class, which in turn is a 
// CPropertyPage-derived class.
void CColorPage::GetPageSelections(CString& str)
{
   str = _T("Color selected is ");
   switch (m_Color)
   {
   case RGB(0, 0, 0):
      str += _T("Black");
      break;

   case RGB(255, 0, 0):
      str += _T("Red");
      break;

   case RGB(0, 255, 0):
      str += _T("Green");
      break;

   case RGB(0, 0, 255):
      str += _T("Blue");
      break;

   default:
      str += _T("Custom");
      break;
   }
}

 

// An example of implementing the GetPageSelections() for CShapePage.
// CShapePage is a CMyPropertyPage-derived class, which in turn is a 
// CPropertyPage-derived class.
void CShapePage::GetPageSelections(CString& str)
{
   CString shapename;
   switch (m_Selection)
   {
   case IDC_RECTANGLE:
      shapename = _T("Rectangle");
      break;

   case IDC_ROUND_RECTANGLE:
      shapename = _T("Round Rectangle");
      break;

   case IDC_ELLIPSE:
      shapename = _T("Ellipse");
      break;
   }

   str.Format(_T("Shape to be created is %s"), shapename);
}

CPropertyPage::OnWizardNext

This member function is called by the framework when the user selects the Next button in a wizard.

virtual LRESULT OnWizardNext();

Return Value

0 to automatically advance to the next page; -1 to prevent the page from changing. To jump to a page other than the next one, return the identifier of the dialog to be displayed.

Remarks

Override this member function to specify some action the user must take when the Next button is pressed.

For more information on how to make a wizard-type property sheet, see CPropertySheet::SetWizardMode.

Example

// The Next button is selected from the propertysheet. Show the 
// second page of the propertysheet ONLY if a non-zero value is 
// entered to the Number edit control of the CStylePage. Otherwise
// display a message to the user and stay on the current page.

LRESULT CStylePage::OnWizardNext()
{
   // Get the number from the edit control
   int num = GetDlgItemInt(IDC_NUMOBJECTS);

   if (num == 0)
   {
      // Display a message to the user
      AfxMessageBox(_T("Supply a non-zero number on the edit control"), MB_OK);

      // Stay on the current page
      return -1;
   }

   // CPropertyPage::OnWizardNext returns zero and causes
   // the property sheet to display the next page
   return CPropertyPage::OnWizardNext();
}

CPropertyPage::QuerySiblings

Call this member function to forward a message to each page in the property sheet.

LRESULT QuerySiblings(
    WPARAM wParam,
    LPARAM lParam);

Parameters

wParam
Specifies additional message-dependent information.

lParam
Specifies additional message-dependent information

Return Value

The nonzero value from a page in the property sheet, or 0 if all pages return a value of 0.

Remarks

If a page returns a nonzero value, the property sheet doesn't send the message to subsequent pages.

Example

// Validate the value entered in the Number edit control. If its 
// value is not a natural number, request CPropertySheet (i.e. parent
// window of the page) to send a PSM_QUERYSIBLINGS message to each
// LOADED page (a page won't be loaded in memory until it is shown).
// If one of the pages returns a nonzero value in response to the 
// PSM_QUERYSIBLINGS message, then inform the user and change the OK
// to Close and disable the Cancel button. CStylePage is a 
// CPropertyPage-derived class.
BOOL CStylePage::OnApply()
{
   int num = GetDlgItemInt(IDC_NUMOBJECTS);
   if (num <= 0)
   {
      if (QuerySiblings(num, 0L))
      {
         AfxMessageBox(_T("Invalid data is entered.  Choose Close ")
            _T("button to close the dialog."));
         CancelToClose();
      }
   }

   return CPropertyPage::OnApply();
}

 

// This is an example of trapping the PSM_QUERYSIBLINGS in one of
// the pages. CColorPage is a CPropertyPage-derived class.  Upon 
// receiving this message, wParam contains the value passed to 
// QuerySiblings() call. CColorPage will check this value and return
// FALSE only if the value is greater than 1.
ON_MESSAGE(PSM_QUERYSIBLINGS, &CColorPage::OnQuerySiblings)

 

LRESULT CColorPage::OnQuerySiblings(WPARAM wParam, LPARAM lParam)
{
   UNREFERENCED_PARAMETER(lParam);
   return (wParam <= 0);
}

CPropertyPage::SetModified

Call this member function to enable or disable the Apply Now button, based on whether the settings in the property page should be applied to the appropriate external object.

void SetModified(BOOL bChanged = TRUE);

Parameters

bChanged
TRUE to indicate that the property page settings have been modified since the last time they were applied; FALSE to indicate that the property page settings have been applied, or should be ignored.

Remarks

The framework keeps track of which pages are "dirty," that is, property pages for which you have called SetModified( TRUE ). The Apply Now button will always be enabled if you call SetModified( TRUE ) for one of the pages. The Apply Now button will be disabled when you call SetModified( FALSE ) for one of the pages, but only if none of the other pages is "dirty."

Example

// OnColorClicked() is a member function of CColorPage (a
// CPropertyPage-derived class). It is called whenever a radio button
// is selected on the page. Call SetModified() to enable the Apply 
// button whenever a new selection is made. m_Color is a member
// variable of CColorPage and it is to store the selected RGB color.
// Its entry in the message map looks like this:
// ON_CONTROL_RANGE(BN_CLICKED, IDC_BLACK, IDC_GREEN, CColorPage::OnColorClicked)
void CColorPage::OnColorClicked(UINT nCmdID)
{
   COLORREF color = m_Color;
   switch (nCmdID)
   {
   case IDC_RADIOBLACK:
      color = RGB(0, 0, 0);
      m_radioColor = crBlack;
      break;

   case IDC_RADIORED:
      color = RGB(255, 0, 0);
      m_radioColor = crRed;
      break;

   case IDC_RADIOGREEN:
      color = RGB(0, 255, 0);
      m_radioColor = crGreen;
      break;

   case IDC_RADIOBLUE:
      color = RGB(0, 0, 255);
      m_radioColor = crBlue;
      break;
   }

   if (color != m_Color)
   {
      m_Color = color;
      SetModified();    // Enable Apply Now button.
   }

   UpdateData(FALSE);
}

See also

MFC Sample CMNCTRL1
MFC Sample CMNCTRL2
MFC Sample PROPDLG
MFC Sample SNAPVW
CDialog Class
Hierarchy Chart
CPropertySheet Class