本文整理汇总了C++中IRichEditOle::GetObjectCount方法的典型用法代码示例。如果您正苦于以下问题:C++ IRichEditOle::GetObjectCount方法的具体用法?C++ IRichEditOle::GetObjectCount怎么用?C++ IRichEditOle::GetObjectCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRichEditOle
的用法示例。
在下文中一共展示了IRichEditOle::GetObjectCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RichEdit_GetImageOle
BOOL RichEdit_GetImageOle(HWND hWnd, POINT pt, IImageOle** pImageOle)
{
IRichEditOle * pRichEditOle;
REOBJECT reobject;
HRESULT hr;
BOOL bRet = FALSE;
if (NULL == pImageOle)
return FALSE;
*pImageOle = NULL;
pRichEditOle = RichEdit_GetOleInterface(hWnd);
if (NULL == pRichEditOle)
return FALSE;
int nCount = pRichEditOle->GetObjectCount();
for (int i = 0; i < nCount; i++)
{
memset(&reobject, 0, sizeof(REOBJECT));
reobject.cbStruct = sizeof(REOBJECT);
hr = pRichEditOle->GetObject(i, &reobject, REO_GETOBJ_POLEOBJ);
if (S_OK == hr)
{
if (reobject.poleobj != NULL)
{
if (CLSID_ImageOle == reobject.clsid)
{
IImageOle * pImageOle2 = NULL;
hr = reobject.poleobj->QueryInterface(__uuidof(IImageOle), (void**)&pImageOle2);
reobject.poleobj->Release();
if (SUCCEEDED(hr))
{
RECT rcObject = {0};
hr = pImageOle2->GetObjectRect(&rcObject);
if (SUCCEEDED(hr))
{
if (::PtInRect(&rcObject, pt))
{
*pImageOle = pImageOle2;
bRet = TRUE;
break;
}
}
pImageOle2->Release();
}
}
else
{
reobject.poleobj->Release();
}
}
}
}
pRichEditOle->Release();
return bRet;
}
示例2: RichEdit_GetCustomPicCount
int RichEdit_GetCustomPicCount(HWND hWnd)
{
IRichEditOle * pRichEditOle;
REOBJECT reobject;
HRESULT hr;
pRichEditOle = RichEdit_GetOleInterface(hWnd);
if (NULL == pRichEditOle)
return 0;
int nCustomPicCnt = 0;
for (int i = 0; i < pRichEditOle->GetObjectCount(); i++)
{
memset(&reobject, 0, sizeof(REOBJECT));
reobject.cbStruct = sizeof(REOBJECT);
hr = pRichEditOle->GetObject(i, &reobject, REO_GETOBJ_POLEOBJ);
if (S_OK == hr)
{
if (reobject.poleobj != NULL)
{
if (CLSID_ImageOle == reobject.clsid)
{
IImageOle * pImageOle2 = NULL;
hr = reobject.poleobj->QueryInterface(__uuidof(IImageOle), (void**)&pImageOle2);
reobject.poleobj->Release();
if (SUCCEEDED(hr))
{
LONG lFaceId = -1, lFaceIndex = -1;
pImageOle2->GetFaceId(&lFaceId);
pImageOle2->GetFaceIndex(&lFaceIndex);
if (-1 == lFaceId && -1 == lFaceIndex)
nCustomPicCnt++;
pImageOle2->Release();
}
}
else
{
reobject.poleobj->Release();
}
}
}
}
pRichEditOle->Release();
return nCustomPicCnt;
}
示例3: GetObjectPos
int UIIMEdit::GetObjectPos()
{
bool findObject = false;
IRichEditOle *pRichEditOle = m_pRichEditOle;
if (NULL == pRichEditOle)
{
return 0;
}
int nCount = pRichEditOle->GetObjectCount();
for (int i = nCount - 1; i >= 0; i--)
{
REOBJECT reobj = { 0 };
reobj.cbStruct = sizeof(REOBJECT);
pRichEditOle->GetObject(i, &reobj, REO_GETOBJ_POLEOBJ);
reobj.poleobj->Release();
}
return 0;
}
示例4: ReleaseAllGif
void UIIMEdit::ReleaseAllGif()
{
SetText(_T(""));
IRichEditOle *pRichEditOle = m_pRichEditOle;
PTR_VOID(pRichEditOle);
for (int i = 0; i < pRichEditOle->GetObjectCount(); i++)
{
REOBJECT reobj = { 0 };
reobj.cbStruct = sizeof(REOBJECT);
pRichEditOle->GetObject(i, &reobj, REO_GETOBJ_POLEOBJ);
GifSmiley::IGifSmileyCtrl* lpAnimator = 0;
HRESULT hr = reobj.poleobj->QueryInterface(GifSmiley::IID_IGifSmileyCtrl, (void**)&lpAnimator);
if (SUCCEEDED(hr) && lpAnimator)
{
lpAnimator->FreeImage();
lpAnimator->Release();
}
reobj.poleobj->Release();
}
}
示例5: GetDrawingProp
void GetDrawingProp(void)
{
if (m_hwnd == NULL) return;
IRichEditOle* RichEditOle;
if (SendMessage(m_hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
REOBJECT reObj = {0};
reObj.cbStruct = sizeof(REOBJECT);
HRESULT hr = RichEditOle->GetObject(m_lastObjNum, &reObj, REO_GETOBJ_NO_INTERFACES);
if (hr == S_OK && reObj.dwUser == (DWORD)(ISmileyBase*)this && reObj.clsid == CLSID_NULL)
m_richFlags = reObj.dwFlags;
else {
long objectCount = RichEditOle->GetObjectCount();
for (long i = objectCount; i--; ) {
HRESULT hr = RichEditOle->GetObject(i, &reObj, REO_GETOBJ_NO_INTERFACES);
if (FAILED(hr)) continue;
if (reObj.dwUser == (DWORD)(ISmileyBase*)this && reObj.clsid == CLSID_NULL) {
m_lastObjNum = i;
m_richFlags = reObj.dwFlags;
break;
}
}
}
RichEditOle->Release();
if ((m_richFlags & REO_SELECTED) == 0) {
CHARRANGE sel;
SendMessage(m_hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (reObj.cp >= sel.cpMin && reObj.cp < sel.cpMax)
m_richFlags |= REO_INVERTEDSELECT;
else
m_richFlags &= ~REO_INVERTEDSELECT;
}
}
示例6: SetPosition
static void SetPosition(HWND hwnd)
{
IRichEditOle* RichEditOle;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
ITextDocument* TextDocument;
if (RichEditOle->QueryInterface(IID_ITextDocument, (void**)&TextDocument) != S_OK) {
RichEditOle->Release();
return;
}
// retrieve text range
ITextRange* TextRange;
if (TextDocument->Range(0, 0, &TextRange) != S_OK) {
TextDocument->Release();
RichEditOle->Release();
return;
}
TextDocument->Release();
int objectCount = RichEditOle->GetObjectCount();
for (int i = objectCount - 1; i >= 0; i--) {
REOBJECT reObj = {0};
reObj.cbStruct = sizeof(REOBJECT);
HRESULT hr = RichEditOle->GetObject(i, &reObj, REO_GETOBJ_POLEOBJ);
if (FAILED(hr)) continue;
ISmileyBase *igsc = NULL;
if (reObj.clsid == CLSID_NULL)
reObj.poleobj->QueryInterface(IID_ISmileyAddSmiley, (void**) &igsc);
reObj.poleobj->Release();
if (igsc == NULL) continue;
TextRange->SetRange(reObj.cp, reObj.cp);
BOOL res;
POINT pt;
RECT rect;
hr = TextRange->GetPoint(tomStart | TA_BOTTOM | TA_LEFT, &pt.x, &pt.y);
if (hr == S_OK) {
res = ScreenToClient(hwnd, &pt);
rect.bottom = pt.y;
rect.left = pt.x;
}
else rect.bottom = -1;
hr = TextRange->GetPoint(tomStart | TA_TOP | TA_LEFT, &pt.x, &pt.y);
if (hr == S_OK) {
res = ScreenToClient(hwnd, &pt);
rect.top = pt.y;
rect.left = pt.x;
}
else rect.top = -1;
igsc->SetPosition(hwnd, &rect);
igsc->Release();
}
TextRange->Release();
RichEditOle->Release();
}
示例7: GetContent
BOOL UIIMEdit::GetContent(OUT MixedMsg& mixMsg)
{
mixMsg.m_strTextData = GetTextRange(0, GetTextLength());
if (mixMsg.m_strTextData.IsEmpty())
return FALSE;
mixMsg.ReplaceReturnKey();
IRichEditOle *pRichEditOle = m_pRichEditOle;
if (NULL == pRichEditOle)
{
return FALSE;
}
UInt32 nImageCount = pRichEditOle->GetObjectCount();
if (nImageCount == 0)//纯文字
{
CString strContent = mixMsg.m_strTextData;
strContent.Trim();
if (strContent.IsEmpty())
{
LOG__(DEBG, _T("After trimed,is empty msg"));//日志干扰
return FALSE;
}
}
else//图文混排
{
CString strEmotionFilesDir = module::getMiscModule()->getEmotionFilesDir();
int nPosAdd = 0;
for (UInt32 i = 0; i < nImageCount; i++)
{
ST_picData picData;
if (GetPicPosAndPathbyOrder(i, picData.nPos, picData.strLocalPicPath))
{
TCHAR fullPath[MAX_PATH] = { 0 };
LPTSTR* pStart = nullptr;
if (!GetFullPathName(picData.strLocalPicPath, MAX_PATH, fullPath, pStart))
{
continue;
}
CString strFullPath = fullPath;
int nPos = strFullPath.Find(strEmotionFilesDir);
if (-1 != nPos)
{
//是表情,不用上传图片
int nLen = picData.strLocalPicPath.GetLength();
CString fileName = strFullPath.Mid(strEmotionFilesDir.GetLength(), nLen - strEmotionFilesDir.GetLength() + 1);
CString fileID;
if (!module::getEmotionModule()->getEmotionIDByName(fileName, fileID))
{
return FALSE;
}
mixMsg.m_strTextData.Insert(nPosAdd + picData.nPos, fileID);
mixMsg.m_strTextData.Delete(nPosAdd + picData.nPos + fileID.GetLength(), 1);
//nPosAdd += picData.nPos + fileID.GetLength();
nPosAdd += fileID.GetLength() - 1;
}
else
{
picData.nPos += nPosAdd;
mixMsg.m_picDataVec.push_back(picData);
}
}
}
}
SetText(_T(""));
return TRUE;
}