1.首先移除项目中包含的Riched20.lib静态库,在linker中。 2.找到RichEditUI.cpp中的如下代码: // Create Text Services component if(FAILED(CreateTextServices(NULL, this, &pUnk))) goto err; 3.用下面的代码替换上面的两行代码: typedef HRESULT(_stdcall *CTSFunc)(IUnknown *punkOuter, ITextHost *pITextHost, IUnknown **ppUnk); CTSFunc ctsFunc = NULL; m_hRiched20 = LoadLibrary(_T("Riched20.dll")); if (NULL == m_hRiched20) goto err; else { ctsFunc = (CTSFunc)GetProcAddress(m_hRiched20, "CreateTextServices"); if (NULL == ctsFunc) goto err; } if (FAILED(ctsFunc(NULL, this, &pUnk))) goto err; 4.在这个类中的析构函数中释放掉Riched20.dll动态库 FreeLibrary(m_hRiched20);