Here are some sketches of how you can format text in rtf + richedit under windows.
// Функция взять-отдать текст int GetSetRtf(HWND Handle, char* data, int max){ DWORD st[5]; // можно использовать стандартную структуру это что б не искать библиотеки st[0] = (DWORD)&st[3]; st[1] = 0 ; st[2] = (DWORD)&EditStreamCallback; st[3] = (DWORD)data; st[4] = max; if (max == 0 ) { return ::SendMessageA(Handle,WM_USER + 73,2,(DWORD)&st); // EM_STREAMIN } else { ::SendMessageA(Handle,WM_USER + 74,2,(DWORD)&st); } } // Вспомагательный стрим DWORD __stdcall EditStreamCallback(char ** cookie,LPBYTE pbBuff, LONG cb, LONG FAR * pcb){ int x = (int)cookie[1]; int j = 0; if (x == 0 ) { while (*cookie[0] != 0 ) { pbBuff[x++] = *cookie[0]++; if (x>=cb) break; } if (x<cb) pbBuff[x] = 0; *pcb = x; } return 0; } // Как использовать CoInitialize(0); // Надо InitCommonControls(); // в msdn написано что надо в случае использования стилей окна, без работает LoadLibraryA("riched20.dll"); // Тоже надо, новая библиотека называется Msftedit.dll можно её HWND Edit1 = CreateWindow("RichEdit20A","(info)", WS_VISIBLE | WS_CHILD | ES_MULTILINE | ES_WANTRETURN |ES_LEFT, 151,32,600,200,w.Handle/*родительское окно*/,0,hInstance,0); GetSetRtf(Edit1, "{\\rtf1\\ansi\\ansicpg1251\\deff0\\deflang1049{\\fonttbl{\\f0\\fswiss\\fcharset0 Courier New;}}\\f0 62452}" , 0);
Link to msdn
If you want to use pictures in rtf, then you need to connect another module in initialization. In most cases, these sketches are enough. Make the text not editable, and so on - set the styles ES _ ***.
It is also necessary to note that 20 is not the latest version - but everywhere 98 XP 2008 works. For Unicode, you need a W-version instead of A. There is somewhere a description of which version that can. I think the support of the old versions will not turn off soon. Many programs use richedit.
The linker does not need to say anything, because additional functions are not used. #include <richedit.h> does not always work well, you need to either correct a define, or connect #include <richedit20.h> . The second version (20) has a fairly good functionality, and the compiler does not always "connect" it.
A few words on the tags. \ need to be escaped with \\ two (but there are four of them in char *). \pard; -new (\ r \ n rtf ignores) \b \b0 put / remove bold. I will not prompt the link to a good help, but it is not difficult to find.