BUG: MFC Feature Pack wizard generated code with CFormView-derived view shows Debug Assertion
| Article ID | : | 956003 |
| Last Review | : | July 21, 2008 |
| Revision | : | 1.0 |
RAPID PUBLISHING
Action
| 1. | Create a MFC Document/View application. |
| 2. | Under Application Type, select the Project style as “Officeâ€Â. |
| 3. | Select Use of MFC as “static libraryâ€Â, Click Next. |
| 4. | Under Generated Classes, select the CFormView as base class for application view. |
| 5. | Click Finish. |
| 6. | A message will appear saying “No printing support will be available for CFormViewâ€Â. Click Yes. |
| 7. | Build and Run your application. |
Result
The application shows a debug assertion on f: dd vctools vc7libs ship atlmfc src mfc afxribbonbar.cpp, Line: 3891
The following function shows the assertion:
CMFCRibbonCategory* CMFCRibbonBar::AddPrintPreviewCategory()
{
        …
    // This line shows the assertion
   ENSURE(str1.LoadString(AFX_IDS_ONEPAGE));
       …
}
Cause
Resolution
Disable the Print Preview for Ribbon Bar. This can be done using CMFCRibbonBar::EnablePrintPreview function.
More Information
This is a know bug with the wizard-generated code. CFormView classes do not have printing support. After creating the project, the wizard does prompt the message “No printing support will be available for CFormViewâ€Â, but it fails to generate correct code for ribbon bar for disabling the printing.
Making the following change allows it to work.
void CMainFrame::InitializeRibbon()
{
           …
           // Disable the Print Preview for Ribbon Bar
           m_wndRibbonBar.EnablePrintPreview(FALSE);
           m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds);
           …
}
As the application links statically to MFC, the ID will not be available in the application instance. All standard MFC resources are selectively built or not built into your module, based on wizard selections. For dynamic link they are always part of the MFC80[u][d].dll.
See Also
Concepts
MFC Hierarchy Chart (http://msdn.microsoft.com/en-us/library/bb982033.aspx)
Reference
CMFCRibbonBar Class (http://msdn.microsoft.com/en-us/library/bb983906.aspx)
DISCLAIMER
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.
APPLIES TO
| • | Microsoft Visual Studio 2008 Academic Edition |
| • | Microsoft Visual Studio 2008 Professional Edition |
| • | Microsoft Visual Studio 2008 Standard Edition |
| • | Microsoft Visual Studio Team System 2008 Database Edition |
| • | Microsoft Visual Studio Team System 2008 Architecture Edition |
| • | Microsoft Visual Studio Team System 2008 Development Edition |
| • | Microsoft Visual Studio Team System 2008 Test Edition |
| • | Microsoft Visual Studio Team System 2008 Team Foundation Server |
| • | Microsoft Visual Studio Team System 2008 Team Suite |
Keywords: |
kbnomt kbrapidpub KB956003 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
Microsoft Corporation. All rights reserved. Terms of Use | Trademarks
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Back to the top
Leave a Reply