DOC: MFC CHKBOOK Sample Uses Incorrect Base Class

Last reviewed: July 10, 1997
Article ID: Q105117
1.00 WINDOWS kbprg kbdocerr kbdocfix

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), included with:

        - Microsoft Visual C++ for Windows, versions 1.0
    

SUMMARY

The CHKBOOK sample for the Microsoft Foundation Classes (MFC) uses the incorrect document base class in the IMPLEMENT_DYNCREATE and BEGIN_MESSAGE_MAP macros that are in CHECKDOC.CPP. This does not cause any errors in this application because the class used is part of the inheritance tree and no conflicts result in this application. However, errors of this type have the potential to cause run-time errors and should be avoided.

The following lines from CHECKDOC.CPP are in error:

   IMPLEMENT_DYNCREATE(CChkBookDoc, CDocument)

   BEGIN_MESSAGE_MAP(CChkBookDoc, CDocument)

These lines should read:

   IMPLEMENT_DYNCREATE(CChkBookDoc, CFixedLenRecDoc)

   BEGIN_MESSAGE_MAP(CChkBookDoc, CFixedLenRecDoc)

The sample was corrected in Visual C++ version 1.5.

MORE INFORMATION

The CHKBOOK sample is installed in the \MSVC\MFC\SAMPLES\CHKBOOK directory by default.

The inheritance tree for CChkBookDoc looks like this:

   CDocument
       |
       - CFixedLenRecDoc
              |
               - CChkBookDoc

Because CDocument is the base class of CFixedLenRecDoc, using it in these macros does not cause a problem in this sample. Using the incorrect base class could cause problems in other applications.


KBCategory: kbprg kbdocerr kbdocfix
KBSubcategory: MfcMisc
Additional reference words: 1.00 1.50 2.00
Keywords : MfcMisc kbdocerr kbdocfix kbprg
Technology : kbMfc
Version : 1.00
Platform : WINDOWS


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.

Last reviewed: July 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.