Microsoft KB Archive/140105

= PRB: Assertion While Switching Property Pages in OLE Control =

Article ID: 140105

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 2.0 Professional Edition

 Microsoft Visual C++ 2.1

 Microsoft Visual C++ 2.2

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

-

<div class="notice_section">

This article was previously published under Q140105

<div class="symptoms_section">

SYMPTOMS
If you have implemented an OLE control that uses a basic MFC CPropertySheet as a user interface, you may receive the following error when trying to switch pages by clicking the tab:

Assertion Failed

OC30D.DLL: File DlgCore.CPP Line 194

<div class="cause_section">

CAUSE
This assertion occurs in _AfxCheckDialogTemplate, when MFC cannot find the dialog template resource for the property page.

<div class="resolution_section">

RESOLUTION
The solution is to override CPropertyPage::OnSetActive and use AFX_MANAGE_STATE as in the following code:

Sample Code
/* Compile options needed - none Add the following code to each of your CPropertyPage-derived classes. */   BOOL CYourPropPage::OnSetActive {    AFX_MANAGE_STATE(_afxModuleAddrThis); return CPropertyPage::OnSetActive; } The prototype for OnSetActive must also be added to your CPropertyPage- derived class header file.

<div class="references_section">