SetDefaultCharFormat fails to set default color

Tech-Archive recommends: Fix windows errors by optimizing your registry



I am using a CRichEditView and trying to display blue characters on a
black background while preserving any other colors in the RTF file.

I am using the following code:

CHARFORMAT2 cf2;

ZeroMemory(&cf2, sizeof(cf2));
cf2.cbSize = sizeof(cf2);
cf2.dwMask = CFM_COLOR;
cf2.crTextColor = RGB(0, 0, 0xff);
GetRichEditCtrl().SetDefaultCharFormat(cf2);
GetRichEditCtrl().SetBackgroundColor(FALSE, RGB(0, 0, 0));

If the RTF file has no colors other than the default color the function
works fine. If I select a part of the file and assign it a color, the
above code changes the background to black correctly. The sections of
the text set to different colors appear properly, but the default text
remains black.

Any ideas?

.