Despite being around for thousands of years, win32 API is poorly documented in many areas. Today I spent an hour battling a baffling problem with rich edit control. I was setting rtf-formatted text using In non-unicode build, where text was ansi, it worked and the text showed up nicely formatted. In unicode build, however, the text wasn’t parsed as rtf and showed verbatim. An hour of trying various ways to make it work ended with me finding a working work-around: using #ifdef UNICODE // Don't know why I have to do this, but SetWindowText() with unicode // doesn't work (rtf codes are not being recognized) const char *sUtf = WstrToUtf8(s); m_statusMsgEdit.SetTextEx((LPCTSTR)sUtf, ST_DEFAULT, CP_UTF8); #else m_statusMsgEdit.SetWindowText(s); #endif MSDN claims I could have used code-page 1200 for unicode text, but that didn’t work either. It’s quite possible I’ve botched something somewhere in my code and this work-around isn’t needed but I can hardly think of anything. If you ever run into problem like this, the above is one thing to try. |