打开DuiLib工程的属性页,进入“链接器” - “输入”选项界面。
删除Debug/Release/UnicodeDebug/UnicodeRelease几个配置中,“附加依赖项”中的“Riched20.lib”(如图1)。
图1打开UIRichEdit.cpp定位到如下源代码:
// Create Text Services component if(FAILED(CreateTextServices(NULL, this, &pUnk))) goto err;
将该段代码修改为如下内容:
HINSTANCE richHandle = NULL; typedef HRESULT (_stdcall *_CTS)( IUnknown *punkOuter, ITextHost *pITextHost, IUnknown **ppUnk) ; _CTS CTS = NULL; richHandle = LoadLibraryW(L"Riched20.dll"); if(richHandle == NULL) exit(0); else { CTS = (_CTS)GetProcAddress(richHandle, "CreateTextServices"); if(NULL == CTS) exit(0); } // Create Text Services component if(FAILED(CTS(NULL, this, &pUnk))) goto err; FreeLibrary(richHandle);