tags:

views:

17

answers:

1

You have to call this before using CRichEditCtrl in a MFC C++ application, and one obvious way is to put it in the application startup code.

However I was thinking about including it in a custom control which subclasses CRichEditCtrl, so that an application doesn't have to remember to make this change.

Is there any potential reason calling this multiple times could cause problems? Or will it simply drop out if already initialized?

+1  A: 

It's safe to call this multiple times.

Note that you can find the code for AfxInitRichEdit2() (and all of MFC) if you chose the option to install MFC sources with Dev Studio. This is well worth doing: MFC source code, although a bit of a mess (!) contains all sorts of interesting examples of writing Windows code. Looking at the code for AfxInitRichEdit2() shows that it's only a 4 line function that can be called multiple times.

DavidK