Please, use [code] and [/code] tags around your lines of code. They will show nicely like this:
Where does m_rich come from?Code:m_rich.SetWindowText (cadena);
Anyway, I have used successfully Rich Edit Controls but I have done it in C, not in C++. I show you what I do when I want to insert a character:
Code:/* ================================================================= Write a character in the RTF control ================================================================= */ int RTFEDIT_putc(char c, COLORREF col, int h, int x) { CHARFORMAT cf; char buf[2]; // HDC hdc; Edit_Enable(hRTF, FALSE); ZeroMemory(&cf, sizeof(CHARFORMAT)); cf.cbSize = sizeof(CHARFORMAT); cf.dwMask = CFM_BOLD | CFM_COLOR | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE; cf.dwEffects = 0; if (h > 0) cf.yHeight = h; else cf.yHeight = 160; cf.yOffset = 0; if (col > 0) cf.crTextColor = col; else cf.crTextColor = RGB(0,0,0); Edit_SetSel(hRTF, x, x+1); buf[0] = c; buf[1] = '\0'; SendMessage(hRTF, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf); Edit_ReplaceSel(hRTF, buf); Edit_SetSel(hRTF, 0, 0); Edit_Enable(hRTF, TRUE); return TRUE; }




Reply With Quote