You cannot create a dialog in Visual C++ if the dialog template has a Rich Edit control
This article was previously published under Q166132 On This PageSYMPTOMS Dialog creation may fail if the dialog template has a Rich
Edit control in it. This template may be used in a dialog, CformView, or
property page. The following error messages may appear in the IDE output window when you execute the program in the debugger with the debug build. No error message or warning is given if you execute the program outside the debugger or with the release build. Dialog or Property PageVisual C++ 5.0:Warning: Dialog creation failed! If this dialog has OLE controls: AfxEnableControlContainer has not been called yet. You should call it in your app's InitInstance function. CFormViewVisual C++ 5.0:Warning: Dialog creation failed! Warning: could not create view for frame. Failed to create client pane/view for frame. Warning: CDocTemplate couldn't create a frame. If this dialog has OLE controls: AfxEnableControlContainer has not been called yet. You should call it in your app's InitInstance function. Failed to create empty document. CAUSE The Rich Edit control is not initialized. RESOLUTION Call the MFC global function AfxInitRichEdit before you
create the dialog to initialize the Rich Edit Control. A good place to
initialize the Rich Edit control is in the application's InitInstance function
before you create the dialog. STATUS This behavior is by design. MORE INFORMATION With the new dialog editor in Visual C++ 5.0, it is
possible to add a Rich Edit control into a dialog template by dragging the
control from the control palette. However, doing this in the dialog editor does
not ensure that the required Riched32.dll library will be loaded before the
Rich Edit control is created. In Win32 SDK, it is necessary to call the
LoadLibrary function to load Riched32.dll before the dialog creation. In MFC,
the global function AfxInitRichEdit does this for you. All you need to do is
call this function before you create the dialog. Please use the online help to get more information on AfxInitRichEdit function. Steps to Reproduce BehaviorDialog ScenarioThe follow scenario reproduces the problem described above with a dialog.
CformView ScenarioThe follow scenario reproduces the problem described above with a CFormView.
APPLIES TO
| Article Translations
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Back to the top
