Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Creating a RichEdit control

rucktp
Débutant
1 290 Visites
Unable to create a Rich Edit control using either the resource editor or the CreateWindow command.

When a Rich Edit control is created in a dialog box using the resource editor the program fails on executation with the error message, "error initializing application". When trying to create a Rich Edit control using "RichEdit_class" with the CreateWindow command the CreateWindow instruction fails to create the control and returns a "0" handle.

See attached sample project for example of the problem. The sample project is a basic dialog Windows application created using the new project wizard and adding a richedit control to the dialog box. The project was compiled and executed both before and after adding the rich edit control. The program executed correctly with out the control but failed when the control was added.
0 Compliments
4 Réponses
Jugoslav_Dujic
Précieux contributeur II
1 290 Visites
See Q261171. Adding LoadLibrary("riched32.dll"C) at the beginning of your WinMain solved the (part of the) problem. Alternatively, you can manually change "RICHEDIT20A" in richedit.rc and load library "riched20.dll" if you need RichEdit v2.

I doubt you can make DlgSet/DlgGet functions work on a RichEdit, though. You'll have to use native APIs (DlgSendCtrlMessage) to communicate with it.

Jugoslav
0 Compliments
Intel_C_Intel
Employé
1 290 Visites
And do somebody know how to drop ASCII files into the RichEditBox? Is it possible to do it from the folder by drawing them with the mouse or even e.g. by double click in the ListBox which is located in the same dialog like RichEditBox. If its possible, the short part of source code would be very appreciated.
Lada.
0 Compliments
Jugoslav_Dujic
Précieux contributeur II
1 290 Visites
Didn't do it myself -- judging on documentation, shouldn't be so hard. You should add WS_EX_ACCEPTFILES window style to the window and call DragAcceptFiles for the window. Then, handle WM_COMMAND/EN_DROPFILES message from RichEdit in the parent window -- call DragQueryFiles to retrieve the file name, OPEN it and copy its contents to the RichEdit, then call DragFinish. See WM_DROPFILES, EN_DROPFILES, DragQueryFiles, DragFinish in the docs.

Oh, and you can't do it with DFLOGM-handled dialog :-D.

Was it you that asked me about XFLOGM about a month ago? XFLOGM 2.0 will be there next week (I sincerely hope so) and you will be able to do it there.

Jugoslav
0 Compliments
Intel_C_Intel
Employé
1 290 Visites
Yes, it was me, who is interested in your Xflogm. But I am not in a hurry. Thanks for your replay.

Lada
0 Compliments
Répondre