Microsoft KB Archive/173027

= FIX: CRichEditView as Second Splitter Pane Causes Crash =

Article ID: 173027

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.1 Subscription 

-

<div class="notice_section">

This article was previously published under Q173027

<div class="symptoms_section">

SYMPTOMS
If an MFC program uses a CRichEditDoc and a CRichEditView is not the first pane of a splitter window, an access violation occurs when you start the program.

<div class="cause_section">

CAUSE
MFC's CRichEditDoc::GetView always assumes the first view of the active frame window is a CRichEditView. The pointer is returned and used as a CRichEditView object even though it may not be. The crash occurs when you use a data member or function specific to CRichEditView.

<div class="resolution_section">

RESOLUTION
Since GetView is not virtual, it cannot be overriden. When using Visual C++ 4.0 or 4.1, make sure that the first pane is a CRichEditView.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in the Microsoft Foundation Classes version 4.2 and shipped with Visual C++ version 4.2.

<div class="moreinformation_section">

MORE INFORMATION
When a CRichEditView is specified during the creation of an MFC program using AppWizard, a CRichEditDoc derived class is created for the program. When the rich edit view is initially displayed, the framework calls CRichEditDoc::SetTitle to update the frame window's title. However, SetTitle calls GetView, which returns the first view in the view list.

(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Adam Kim, Microsoft Corporation

Keywords: kbbug kbfix kbvc420fix kbdocview KB173027

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.