Click to See Complete Forum and Search --> : Rich Edit Control Problem


msanford
July 27th, 2005, 10:59 AM
Hi all,

I added a rich edit control to one of my dialogs in a Wiz97 Stlye wizard, and when I add the control the Dialog does not appear (ie the Welecome dialog replaces it), If I take the Rich edit control off the Dialog appears and functions as expected. I am calling InitCommonControls() at the begining of program execution.

This is the first time I have attempted to to do any thing with a Rich Edit control, and I am sure that I am missing something really stupid but I have hunted around, read the Control info on the MSDN and searched on this site for the soltuion, but it seems to be eluding me. Can anyone please point me in the right direction?

Thanks in advance

Smasher/Devourer
July 27th, 2005, 06:31 PM
I don't think it's a stupid mistake; I had the same problem the first time I tried creating a Rich Edit control. The reason it doesn't work is that you have to load RichEdit32.dll. If you try creating a Rich Edit control prior to doing so, then the appropriate window class will not be defined, and you should get a message indicating as much if you call GetLastError() after the attempt to create your dialog box fails. So, just place this at the beginning of your program:
LoadLibrary("RichEd32.dll");
Just for future reference, if you use Rich Edit controls in an MFC program, MFC provides a function called AfxInitRichEdit(). Basically all it does is to call the function listed above and retain the result, along with a check to make sure that the library is only loaded once.