BUG: Error message when an MFC application contains an event handler that uses the CRichEditView::FindText method or the CRichEditView::FindTextSimple method in Visual Studio 2005: "Debug Assertion Failed" (922318)
The information in this article applies to:
- Microsoft Visual Studio 2005 Team System Architect Edition
- Microsoft Visual Studio 2005 Team System Developer Edition
- Microsoft Visual Studio 2005 Team System Team Foundation:
- Microsoft Visual Studio 2005 Team System Test Edition
- Microsoft Visual Studio 2005 Standard Edition
- Microsoft Visual Studio 2005 Professional Edition
- Microsoft Visual Studio 2005 Express Edition
SYMPTOMSConsider the following scenario: - You create a Microsoft Foundation Classes (MFC) application in Microsoft Visual Studio 2005.
- The base class for the MFC application is the CRichEditView class.
- The MFC application contains an event handler that uses the CRichEditView::FindText method or the CRichEditView::FindTextSimple method.
- You compile the MFC application and run the MFC application.
- You invoke the event handler so that the CRichEditView::FindText method or the CRichEditView::FindTextSimple method returns false. For example, you specify a search string that contains text that is not in the text window.
In this scenario, you may receive the following error message when the CRichEditView::FindText method or the CRichEditView::FindTextSimple method returns false on subsequent function calls: Debug Assertion Failed!
Program: ... File: f:\rtm\vctools\vc7libs\ship\atlmfc\src\mfc\viewrich.cpp Line: 1677 WORKAROUNDTo work around this problem, call the CRichEditView::TextNotFound method immediately after a call to the CRichEditView::FindText method or to the CRichEditView::FindTextSimple method returns false. The CRichEditView::TextNotFound method resets the internal search state of the CRichEditView class instance. The following code example demonstrates how to use the CRichEditView::TextNotFound method. CString szSearch = _T("search text");
if (!FindText( szSearch, FALSE, FALSE ))
{
// The search string was not found. Call the TextNotFound method.
TextNotFound( szSearch );
}
else
{
// The search string was found. Add code to process the successful search result here.
}
STATUS Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.REFERENCESFor more information about the CRichEditView class, visit the following Microsoft Developer Network (MSDN) Web site:
For more information about the CRichEditView::TextNotFound method, visit the following MSDN Web site:
Modification Type: | Major | Last Reviewed: | 7/31/2006 |
---|
Keywords: | kbtshoot kbcode kbbug KB922318 kbAudDeveloper |
---|
|