Figure 2: Replacement WM_NCCREATE handler to avoid a Rich Edit bug
class CRichEditWindow : public CWindowImpl<CRichEditWindow,CRichEditCtrl> { public: ... BEGIN_MSG_MAP(CRichEditWindow) MESSAGE_HANDLER(WM_NCCREATE, OnNCCreate) ... END_MSG_MAP() LRESULT OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { LPCREATESTRUCT pcs = reinterpret_cast<LPCREATESTRUCT>(lParam); DWORD dwClass = reinterpret_cast<DWORD>(pcs->lpszClass); if ( dwClass && dwClass <= MAXINTATOM ) pcs->lpszClass = GetWndClassName(); return DefWindowProc(uMsg, wParam, lParam); } ... };