1、打開DuiLib工程的屬性頁,進入“鏈接器” - “輸入”選項界面。
2、刪除Debug/Release/UnicodeDebug/UnicodeRelease幾個配置中,“附加依賴項”中的“Riched20.lib”(如圖1)。
/
3、打開UIRichEdit.cpp定位到如下源代碼:
// Create Text Services component
if(FAILED(CreateTextServices(NULL, this, &pUnk)))
goto err;
4、將該段代碼修改爲如下內容:
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);