Microsoft KB Archive/262024

= How To Use CPropertySheet as a Child of CSplitterWnd =

Article ID: 262024

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q262024

<div class="summary_section">

SUMMARY
This article describes how to create a property sheet or tabbed view on the left or right pane of a splitter window (CSplitterWnd), similar to the MSDN library property sheet.

<div class="moreinformation_section">

Steps to Create a Sample Project:
<ol> Create a Microsoft Foundation Class Library (MFC) AppWizard (.exe) based project named Sample.</li> In step 1 of the MFC AppWizard, select the Single Document check box.</li> For steps 2 through 4 of the MFC AppWizard, select the default settings.</li> In step 5 of the MFC AppWizard, select the Windows Explorer check box as the project style.</li> For step 6 of the MFC AppWizard, select the default setting.</li> Form the Project menu, point to Add to Project, and then select Components and Controls.... Under Visual C++ Components, select Property Sheet, and then click Insert and OK.</li> In the Property Sheet wizard, select Property Sheet, select Yes for Modeless, and then give CSampleView access to this property sheet. Select the default for the remaining items on the wizard. Close the Components and Controls dialog box. The property sheet is displayed in the right pane.</li>  Add a protected member variable to CSampleView, as demonstrated in the following example: protected: CMyPropertySheet* m_pSheet; </li>  Add the following line to the CSampleView Constructor: m_pSheet = new CMyPropertySheet; </li>  Add a WM_CREATE message to CSampleView with Windows Message and Event Handler, and then add the following code to the handler: m_pSheet->Create(this,WS_CHILD | WS_VISIBLE | WS_THICKFRAME); The code for the handler looks like the following: int CSampleView::OnCreate(LPCREATESTRUCT lpCreateStruct) {   if (CListView::OnCreate(lpCreateStruct) == -1) return -1; m_pSheet->Create(this,WS_CHILD | WS_VISIBLE | WS_THICKFRAME); return 0; }                   </li>  Use Windows Message and Event Handler to add a WM_SIZE message to CSampleView, and then add the following code to the handler: void CSampleView::OnSize(UINT nType, int cx, int cy) {   CListView::OnSize(nType, cx, cy); // TODO: Add your message handler code here m_pSheet->MoveWindow(CRect(0,0,cx,cy)); m_pSheet->GetTabControl->MoveWindow(0,0,cx,cy); }                   </li>  Use the Windows Message and Event Handler to add a WM_DESTROY message to CSampleView, and then add the following code to the handler: void CSampleView::OnDestroy {   CListView::OnDestroy; m_pSheet->DestroyWindow; }                   </li> Select Build, and then select Rebuild All. Correct any errors, and then execute the sample.</li></ol>

Keywords: kbdlg kbdocview kbhowto kbpropsheet KB262024

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.