Reputation: 1809
I have a richedit control on a dialog. I want to populate the richedit control with a string. The richedit control itself displays properly. But I don't know how to populate the richedit control with a string. I took a guess at it below, in the resource.rc code.
In main.cpp, I have:
case IDC_BUT_ABOUT:
{
HINSTANCE hRichEdit;
hRichEdit = LoadLibrary("RICHED32.DLL");
DialogBox( hInst, MAKEINTRESOURCE(IDD_ABOUT), hDlgWnd,(DLGPROC)InitAbout );
//ShowWindow(hDlgWnd, SW_SHOWNORMAL);
return TRUE;
}
break;
In resource.rc, I have:
IDD_ABOUT DIALOGEX 0, 0, 206, 136
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Close",IDCANCEL,77,115,50,14
CONTROL "",IDC_RICHEDIT21,"RichEdit20W",ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_TABSTOP,36,53,130,46
END
string rt = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fprq2\fcharset0 Biondi;}}{\colortbl ;\red255\green0\blue0;}\viewkind4\uc1\pard\f0\fs20\par\cf1\f1 hello\cf0\f0 \ul some text here\par}";
this.IDC_RICHEDIT21.Rtf = rt;
But this apparently isn't even close to how I should put text from a string into a rich edit control?
Upvotes: 0
Views: 1170