DOCUMENT:Q140105 06-MAY-2001 [visualc] TITLE :PRB: Assertion While Switching Property Pages in OLE Control PRODUCT :Microsoft C Compiler PROD/VER:winnt:2.0,2.1,2.2,4.0 OPER/SYS: KEYWORDS:kbActiveX kbCOMt kbCtrlCreate kbMFC kbPropSheet kbVC200 kbVC210 kbVC220 kbVC400 kbGrpDS ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - The Microsoft Foundation Classes (MFC), used with: - Microsoft Visual C++, 32-bit Editions, versions 2.0, 2.1, 2.2, 4.0 ------------------------------------------------------------------------------- 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 CAUSE ===== This assertion occurs in _AfxCheckDialogTemplate, when MFC cannot find the dialog template resource for the property page. 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. REFERENCES ========== For information on AFX_MANAGE_STATE, please see the following article in the Microsoft Knowledge Base: Q127074 How to Use AFX_MANAGE_STATE in an OLE Control Additional query words: kbvc200 kbvc210 kbvc220 kbvc400 kbmfc ====================================================================== Keywords : kbActiveX kbCOMt kbCtrlCreate kbMFC kbPropSheet kbVC200 kbVC210 kbVC220 kbVC400 kbGrpDSMFCATL kbNoUpdate Technology : kbAudDeveloper kbMFC Version : winnt:2.0,2.1,2.2,4.0 Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.