Microsoft KB Archive/105117

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 15:03, 18 July 2020 by 3155ffGd (talk | contribs) (importing KB archive)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

DOC: MFC CHKBOOK Sample Uses Incorrect Base Class


1.00 WINDOWS kbprg kbdocerr

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), used with:
    • Microsoft Visual C++


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:


   BEGIN_MESSAGE_MAP(CChkBookDoc, CDocument) 

These lines should read:


   BEGIN_MESSAGE_MAP(CChkBookDoc, CFixedLenRecDoc) 

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


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

The inheritance tree for CChkBookDoc looks like this:


| - 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.

Additional query words: 1.00 1.50 2.00

Keywords : kbdocfix kb16bitonly kbDocView kbMFC kbVC100bug kbVC150fix kbSampleProd kbDSupport kbGrpDSMFCATL
Issue type :
Technology : kbAudDeveloper kbMFC

Last Reviewed: May 8, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.