本文整理汇总了C++中IRichEditOle::GetObject方法的典型用法代码示例。如果您正苦于以下问题:C++ IRichEditOle::GetObject方法的具体用法?C++ IRichEditOle::GetObject怎么用?C++ IRichEditOle::GetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRichEditOle
的用法示例。
在下文中一共展示了IRichEditOle::GetObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPicPosAndPathbyOrder
BOOL UIIMEdit::GetPicPosAndPathbyOrder(IN UInt32 nOrder, OUT UInt32& nPos, OUT CString& path)
{
IRichEditOle* pRichEditOle = m_pRichEditOle;
PTR_FALSE(pRichEditOle);
REOBJECT reobj = { 0 };
reobj.cbStruct = sizeof(REOBJECT);
HRESULT hr = pRichEditOle->GetObject(nOrder, &reobj, REO_GETOBJ_POLEOBJ);
if (SUCCEEDED(hr) && reobj.poleobj)
{
GifSmiley::IGifSmileyCtrl* lpAnimator = 0;
hr = reobj.poleobj->QueryInterface(GifSmiley::IID_IGifSmileyCtrl, (void**)&lpAnimator);
if (SUCCEEDED(hr) && lpAnimator)
{
CComBSTR fileName;
hr = lpAnimator->FileName(&fileName);
if (SUCCEEDED(hr) && 0 != fileName.Length())
{
nPos = reobj.cp;
path = CString(fileName.m_str);
}
lpAnimator->FreeImage();
lpAnimator->Release();
}
reobj.poleobj->Release();
return TRUE;
}
return FALSE;
}
示例2: 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;
}
示例3: 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;
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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();
}
}
示例7: 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();
}
示例8: RichEdit_GetText
// 获取文本
void RichEdit_GetText(ITextServices * pTextServices, tstring& strText)
{
REOBJECT reobject;
LONG nFaceId, nPos = 0;
tstring strOrgText, strTemp;
IRichEditOle * pRichEditOle = RichEdit_GetOleInterface(pTextServices);
if (NULL == pRichEditOle)
return;
CHARRANGE chrg = {0, RichEdit_GetWindowTextLength(pTextServices)};
RichEdit_GetTextRange(pTextServices, &chrg, strOrgText);
for (LONG i = 0; i < (int)strOrgText.size(); i++)
{
memset(&reobject, 0, sizeof(REOBJECT));
reobject.cbStruct = sizeof(REOBJECT);
reobject.cp = i;
HRESULT hr = pRichEditOle->GetObject(REO_IOB_USE_CP, &reobject, REO_GETOBJ_POLEOBJ);
if (SUCCEEDED(hr))
{
if (reobject.cp > 0 && reobject.cp > nPos)
{
strTemp = strOrgText.substr(nPos, reobject.cp-nPos);
Replace(strTemp, _T("/"), _T("//"));
strText += strTemp;
}
nPos = reobject.cp + 1;
if (NULL == reobject.poleobj)
continue;
if (CLSID_ImageOle == reobject.clsid)
{
IImageOle * pImageOle = NULL;
hr = reobject.poleobj->QueryInterface(__uuidof(IImageOle), (void**)&pImageOle);
if (SUCCEEDED(hr))
{
pImageOle->GetFaceId(&nFaceId);
if (nFaceId != -1)
{
TCHAR cBuf[32] = {0};
wsprintf(cBuf, _T("/f[\"%03d\"]"), nFaceId);
strText += cBuf;
}
else
{
strText += _T("/c[\"");
BSTR bstrFileName = NULL;
pImageOle->GetFileName(&bstrFileName);
strText += bstrFileName;
::SysFreeString(bstrFileName);
strText += _T("\"]");
}
pImageOle->Release();
}
}
reobject.poleobj->Release();
}
}
if (nPos < (int)strOrgText.size())
{
strTemp = strOrgText.substr(nPos);
Replace(strTemp, _T("/"), _T("//"));
strText += strTemp;
}
pRichEditOle->Release();
}