CRichEditCtrl in CDialog - basics

Posted on 1999-12-09
Medium Priority
Last Modified: 2013-11-20
This is a very basic question: How do I put a CRichEditCtrl window in a dialog ?

I created a test CDialog-based application with dialog MyDialog, and it worked. But as soon as I dragged a CRichEditCtrl resource to add rich edit window to my dialog template, the application quit working, failing on MyDialog.DoModal(). I used class wizard to add CRichEditCtrl member m_RichEdit to MyDialog, and call m_RichEdit.Create(), but with no result.
Question by:olegsp
  • 2
  • 2

Author Comment

ID: 2269869
Edited text of question.

Accepted Solution

captainkirk earned 200 total points
ID: 2269920
I believe you have to call AfxInitRichEdit() before you can use the control...

Author Comment

ID: 2269970
You are right !

Can you explain what AfxInitRichEdit() actually does?  Why MSDN documentation on this function says "If you use rich edit via CRichEditCtrl, you don't need to call this function." - this is exactly what I am doing, but I have to call AfxInitRichEdit() !

Expert Comment

ID: 2269990
Here's the (scanty) documentation on this:

BOOL AFXAPI AfxInitRichEdit( );


Call this function to initialize the rich edit control for the application. It will also initialize the common controls library, if the library hasn’t already been initialized for the process. If you use the rich edit control directly from your MFC application, you should call this function to assure that MFC has properly initialized the rich edit control runtime. If you use rich edit via CRichEditCtrl, CRichEditView, or CRichEditDoc, you don't need to call this function.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question