2 csdnt90 csdnt90 于 2015.06.26 13:33 提问

游戏中聊天发送表情,不能显示在聊天界面?求指教

输入列表中有表情按钮,点击之后又表情列表,但是点击单个表情之后,表情列表退出,在聊天界面中只显示“[用户]说:”不能显示表情;
问题可能出在加载图像上面。
插入图片代码:
bool CSkinRichEdit::InsertImage(LPCTSTR pszImage)
{
//变量定义
LPOLEOBJECT lpOleObject=NULL;
LPOLECLIENTSITE pIOleClientSite=NULL;

//保存状态
CHARRANGE CharRange;
GetSel(CharRange.cpMin,CharRange.cpMax);

//变量定义
bool bResumeSelect=(CharRange.cpMax!=CharRange.cpMin);

try
{
    //变量定义
    IGifAnimatorPtr lpIGifAnimator;

    //创建对象
    if (FAILED(lpIGifAnimator.CreateInstance(CLSID_GifAnimator)))
    {
        ASSERT(FALSE);
        throw 0L;
    }

    //加载图像
    //if (FAILED(lpIGifAnimator->LoadFromFile((LPCWSTR)(CT2CW(pszImage)))))
    if (FAILED(lpIGifAnimator->LoadFromFile((LPCWSTR)(CT2CW((LPCTSTR)("Expression/000.gif"))))))
    {
        ASSERT(FALSE);
        throw 0L;
    }

    //获取对象
    if (FAILED(lpIGifAnimator->QueryInterface(IID_IOleObject,(VOID * *)&lpOleObject)))
    {
        ASSERT(FALSE);
        throw 0L;
    }

    //查询接口
    ASSERT(m_pIRichEditOLE!=NULL);
    m_pIRichEditOLE->GetClientSite(&pIOleClientSite);

    //变量定义
    REOBJECT ReObject;
    ZeroMemory(&ReObject,sizeof(REOBJECT));

    //设置变量
    ReObject.cbStruct=sizeof(ReObject); 
    ReObject.dwUser=0;
    ReObject.cp=REO_CP_SELECTION;
    ReObject.dwFlags=REO_BELOWBASELINE;
    ReObject.dvaspect=DVASPECT_CONTENT;
    ReObject.pstg=NULL;
    ReObject.poleobj=lpOleObject;
    ReObject.polesite=pIOleClientSite;

    //设置选择
    SetSel(-1,-1);

    //插入对象
    m_pIRichEditOLE->InsertObject(&ReObject);

    //释放对象
    SafeRelease(pIOleClientSite);

    //状态设置
    if (bResumeSelect==true)
    {
        SetSel(CharRange);
    }
    else
    {
        SendMessage(WM_VSCROLL,SB_BOTTOM,0);
    }

    //更新窗体
    RedrawWindow(NULL,NULL,RDW_ERASE|RDW_UPDATENOW|RDW_INVALIDATE);

    return true;
}
catch (...)
{
    //释放对象
    SafeRelease(lpOleObject);
    SafeRelease(pIOleClientSite);
}

return false;

}

Csdn user default icon
上传中...
上传图片
插入图片