zoukankan      html  css  js  c++  java
  • 移除DuiLib项目Linker中的riched20.lib

    如果已安装Windows SDK、Windows Mobile SDK且默认包含这些目录编译源代码没有问题。由于一些改动需要版本管理发现Build Agent运行失败,考虑到迁移各方面原因还是决定修改调用部分。

    首先移除项目几个配置版本Linker里的riched20.lib,之后打开UIRichEdit.cpp定位到如下源代码:

    // Create Text Services component
    if(FAILED(CreateTextServices(NULL, this, &pUnk)))
        goto err;

    我们需要将Riched20.dll动态加载进来,CreateTextServices的函数原型如下:

    HRESULT CreateTextServices(IUnknown*, IUnknown*, IUnknown*)

    修改代码如下,需要注意在获取到ITextServices接口指针后不能立刻调用FreeLibrary释放Riched20.dll的模块句柄,而是在析构函数里:

    typedef HRESULT(_stdcall *CTSFunc)(IUnknown *punkOuter, ITextHost *pITextHost, IUnknown **ppUnk);
    CTSFunc ctsFunc = NULL;
    auto hRiched20 = LoadLibrary(_T("Riched20.dll"));
    
    if (NULL == hRiched20)
        goto err;
    else
    {
        ctsFunc = (CTSFunc)GetProcAddress(hRiched20, "CreateTextServices");
    
        if (NULL == ctsFunc)
            goto err;
    }
    
    if (FAILED(ctsFunc(NULL, this, &pUnk)))
        goto err;
  • 相关阅读:
    sql 删除重复行
    sql 内连接和外链接
    浏览器内核
    asp.net session
    使用powerdesigner创建数据库表
    数据库中char, varchar, nvarchar的差异
    概要设计和详细设计说明书的区别
    2.类和对象
    1.Basic Layouts
    1.初学c++,比较困惑的问题。
  • 原文地址:https://www.cnblogs.com/junchu25/p/3320778.html
Copyright © 2011-2022 走看看