Add text to RichEdit control

Started by TimoVJL, June 14, 2010, 03:19:05 PM

Previous topic - Next topic

TimoVJL

Is there another/better way to add text to RichEdit-control ?

void Add2REdit(HWND hEdit, char *szText)
{
SETTEXTEX st = {ST_SELECTION, CP_ACP};

SendMessage(hEdit, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)szText);
}

An example:

Add2REdit(hEdit, "{\\rtf\\ansi\\deff0{\\fonttbl{\\f0 New Courier;}}Text1\\par \\b Text2\\par ");
Add2REdit(hEdit, "{\\rtf\\ansi\\deff0{\\fonttbl{\\f0 New Courier;}}Text3\\par \\b Text4\\par ");
May the source be with you