本文整理汇总了C++中IRichEditOle类的典型用法代码示例。如果您正苦于以下问题:C++ IRichEditOle类的具体用法?C++ IRichEditOle怎么用?C++ IRichEditOle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRichEditOle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SetRichCallback
bool SetRichCallback(HWND hwnd, MCONTACT hContact, bool subany, bool subnew)
{
RichEditData* rdt = g_RichEditList.find((RichEditData*)&hwnd);
if (rdt == NULL) {
IRichEditOle* RichEditOle;
if (SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return false;
RichEditOle->Release();
rdt = new RichEditData;
rdt->hwnd = hwnd;
rdt->hContact = hContact;
rdt->inputarea = (GetWindowLongPtr(hwnd, GWL_STYLE) & ES_READONLY) == 0;
rdt->dontReplace = false;
rdt->tipActive = -1;
rdt->hToolTip = NULL;
g_RichEditList.insert(rdt);
if (subnew)
mir_subclassWindow(hwnd, RichEditSubclass);
}
else {
if (hContact && !rdt->hContact)
rdt->hContact = hContact;
if (subany)
mir_subclassWindow(hwnd, RichEditSubclass);
}
return true;
}
示例3: bbCodeImageFunc
static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt, DWORD cookie)
{
ITextServices *ts = ftd->getTextService();
ITextDocument *td = ftd->getTextDocument();
long cnt;
LRESULT lResult;
/*
TEXTRANGE trg;
trg.chrg = range;
trg.lpstrText = new TCHAR[trg.chrg.cpMax - trg.chrg.cpMin + 1];
ts->TxSendMessage(EM_GETTEXTRANGE, 0, (LPARAM)&trg, &lResult);
MessageBox(0, txt, trg.lpstrText, MB_OK);
*/
ts->TxSendMessage(EM_SETSEL, range.cpMin, range.cpMax, &lResult);
IRichEditOle* RichEditOle;
ts->TxSendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle, &lResult);
td->Freeze(&cnt);
// HDC emfdc = CreateEnhMetaFile(NULL, NULL, NULL, _T("icon"));
// DrawIconEx(emfdc, 0, 0, (HICON)_ttol(txt), 16, 16, 0, NULL, DI_NORMAL);
// InsertBitmap(RichEditOle, CloseEnhMetaFile(emfdc));
#ifdef _WIN64
bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_tstoi64(txt)));
#else
bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_ttoi(txt)));
#endif
td->Unfreeze(&cnt);
RichEditOle->Release();
return res;
}
示例4: RichEdit_InsertFace
// 插入表情图片
BOOL RichEdit_InsertFace(ITextServices *pTextServices, ITextHost *pTextHost,
LPCTSTR lpszFileName, int nFaceId, int nFaceIndex,
COLORREF clrBg, BOOL bAutoScale, int nReservedWidth)
{
BSTR bstrFileName = NULL;
IRichEditOle * pRichEditOle = NULL;
IOleClientSite *pOleClientSite = NULL;
IImageOle* pImageOle = NULL;
IOleObject *pOleObject = NULL;
REOBJECT reobject = {0};
HRESULT hr = E_FAIL;
if (NULL == pTextServices || NULL == pTextHost ||
NULL == lpszFileName || NULL == *lpszFileName)
return FALSE;
TCHAR cProtocol[16] = {0};
_tcsncpy(cProtocol, lpszFileName, 7);
if ((_tcsicmp(cProtocol, _T("http://")) != 0) && ::GetFileAttributes(lpszFileName) == 0xFFFFFFFF)
return FALSE;
bstrFileName = ::SysAllocString(lpszFileName);
if (NULL == bstrFileName)
return FALSE;
pTextServices->TxSendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle, NULL);
if (NULL == pRichEditOle)
goto Ret0;
hr = ::CoCreateInstance(CLSID_ImageOle, NULL,
CLSCTX_INPROC_SERVER, IID_IImageOle, (void**)&pImageOle);
if (FAILED(hr))
goto Ret0;
hr = pImageOle->QueryInterface(IID_IOleObject, (void **)&pOleObject);
if (FAILED(hr))
goto Ret0;
pRichEditOle->GetClientSite(&pOleClientSite);
if (NULL == pOleClientSite)
goto Ret0;
pOleObject->SetClientSite(pOleClientSite);
pImageOle->SetTextServices(pTextServices);
pImageOle->SetTextHost(pTextHost);
pImageOle->SetFaceId(nFaceId);
pImageOle->SetFaceIndex(nFaceIndex);
pImageOle->SetBgColor(clrBg);
pImageOle->SetAutoScale(bAutoScale, nReservedWidth);
pImageOle->LoadFromFile(bstrFileName);
hr = ::OleSetContainedObject(pOleObject, TRUE);
reobject.cbStruct = sizeof(REOBJECT);
reobject.clsid = CLSID_ImageOle;
reobject.cp = REO_CP_SELECTION;
reobject.dvaspect = DVASPECT_CONTENT;
reobject.dwFlags = REO_BELOWBASELINE;
reobject.poleobj = pOleObject;
reobject.polesite = pOleClientSite;
reobject.dwUser = 0;
hr = pRichEditOle->InsertObject(&reobject);
Ret0:
if (pOleObject != NULL)
pOleObject->Release();
if (pImageOle != NULL)
pImageOle->Release();
if (pOleClientSite != NULL)
pOleClientSite->Release();
if (pRichEditOle != NULL)
pRichEditOle->Release();
if (bstrFileName != NULL)
::SysFreeString(bstrFileName);
return SUCCEEDED(hr);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: SetText
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();
}
}
示例9: bbCodeImageFunc
static bool bbCodeImageFunc(IFormattedTextDraw *ftd, CHARRANGE range, TCHAR *txt, DWORD)
{
ITextServices *ts = ftd->getTextService();
ITextDocument *td = ftd->getTextDocument();
long cnt;
LRESULT lResult;
ts->TxSendMessage(EM_SETSEL, range.cpMin, range.cpMax, &lResult);
IRichEditOle* RichEditOle;
ts->TxSendMessage(EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle, &lResult);
td->Freeze(&cnt);
#ifdef _WIN64
bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_tstoi64(txt)));
#else
bool res = InsertBitmap(RichEditOle, CacheIconToEmf((HICON)_ttoi(txt)));
#endif
td->Unfreeze(&cnt);
RichEditOle->Release();
return res;
}
示例10: 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;
}
}
示例11: 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();
}
示例12: 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();
}
示例13: GetTextRange
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;
}
示例14: throw
void CExRichEditWindowless::InsertGif(LONG gif)
{
CComQIPtr<IDynamicOleCom> spDyn;
HRESULT hr = spDyn.CoCreateInstance(STR_PROGID);
if(SUCCEEDED(hr))
{
LPOLEOBJECT lpOleObject = NULL;
HRESULT hr = spDyn->QueryInterface(IID_IOleObject, (void**)&lpOleObject);
IUnknownPtr lpUnk = lpOleObject;
hr = lpUnk->QueryInterface(IID_IOleObject, (LPVOID*)&lpOleObject);
if (lpOleObject == NULL)
throw(E_OUTOFMEMORY);
//hr = lpOleObject->SetClientSite( static_cast<IOleClientSite *>( this ) );
IViewObject2Ptr lpViewObject;// IViewObject for IOleObject above
hr = lpOleObject->QueryInterface(IID_IViewObject2, (LPVOID*)&lpViewObject);
if (hr != S_OK)
{
AtlThrow(hr);
}
IRichEditOle* pRichEditOle = GetIRichEditOle();
////获取RichEdit的OLEClientSite
IOleClientSitePtr lpClientSite;
hr = pRichEditOle->GetClientSite(&lpClientSite);
if (hr != S_OK)
{
AtlThrow(hr);
}
REOBJECT reobject;
ZeroMemory(&reobject,sizeof(REOBJECT));
reobject.cbStruct = sizeof(REOBJECT);
CLSID clsid;
hr = lpOleObject->GetUserClassID(&clsid);
if (hr != S_OK)
{
AtlThrow(hr);
}
reobject.clsid = clsid;
reobject.cp = -1;
//reobject.cp = REO_CP_SELECTION;
reobject.dvaspect = DVASPECT_CONTENT;//DVASPECT_OPAQUE;
reobject.poleobj = lpOleObject;
reobject.polesite = lpClientSite;
//reobject.pstg = lpStorage;
SIZEL sizel;
sizel.cx = sizel.cy = 0; // let richedit determine initial size
Image* img = (Image*)gif;
SIZEL sizeInPix = {img->GetWidth(), img->GetHeight()};
SIZEL sizeInHiMetric;
AtlPixelToHiMetric(&sizeInPix, &sizeInHiMetric);
reobject.sizel = sizeInHiMetric;
reobject.dwFlags = REO_BELOWBASELINE|REO_STATIC;//REO_RESIZABLE
CExRichEditData* pdata = new CExRichEditData;
pdata->m_dataType = GIF;
pdata->m_data = (void*)gif;
reobject.dwUser = (DWORD)pdata;//TODO 用户数据
lpOleObject->SetClientSite(lpClientSite);
hr = pRichEditOle->InsertObject(&reobject);
lpOleObject->SetExtent(DVASPECT_CONTENT, &sizeInHiMetric);
OleSetContainedObject(lpOleObject, TRUE);
lpOleObject->Release();
spDyn->SetHostWindow((LONG)hwndParent);
spDyn->InsertGif(gif);
}
}
示例15: UNREFERENCED_PARAMETER
//.........这里部分代码省略.........
// No need for the scrollbar, show the edit
// control without the WS_VSCROLL style
ShowWindow(hText, SW_SHOWNORMAL);
}
else
{
// We need the vertical scrollbar, show the edit control
// with the WS_VSCROLL style. Note that textScrollID and
// textNoScrollID may point to the same window, so reset
// the text in the control (bug #DPEV-6JUJSQ)
hText = GetDlgItem(hDlg, textScrollID);
SendMessageA(hText,WM_SETTEXT,0,(LPARAM)"");
SendMessageA(hText,setTextMsg,setTextParam,(LPARAM)aboutText);
ShowWindow(hText, SW_SHOWNORMAL);
}
// Add full SDK name to the RichEdit control by replacing <sdk_name> tag with the
// name defined in SdkProductInfo.h. Note that decision between MIDP and C++ SDK
// product names is made using CWinMenubar iMidpSdk member.
static const TCHAR keywordHeading[] = TEXT("<sdk_name>");
static const UINT keywordHeadingLen = COUNT(keywordHeading)-1;
FINDTEXT findHeading;
ZeroMemory(&findHeading, sizeof(findHeading));
findHeading.chrg.cpMax = -1;
findHeading.lpstrText = (LPTSTR)keywordHeading;
// Select whole content
SendMessage(hText, EM_SETSEL, 0, 0);
// Find from selection
int pos = SendMessage(hText,EM_FINDTEXT, FR_MATCHCASE|FR_DOWN,
(LPARAM)&findHeading);
if (pos >= 0) {
// Sdk name tag found
IRichEditOle* re = NULL;
SendMessage(hText, EM_GETOLEINTERFACE, 0, (LPARAM)&re);
if (re) {
// Select SDK name tag and replace it with the full SDK name
SendMessage(hText, EM_SETSEL, pos, pos+keywordHeadingLen);
if(menubar->iMidpSDK)
SendMessage(hText, EM_REPLACESEL, true, (LPARAM)TEXT(SDK_FULL_PRODUCT_NAME_MIDP));
else
SendMessage(hText, EM_REPLACESEL, true, (LPARAM)TEXT(SDK_FULL_PRODUCT_NAME_CPP));
re->Release();
}
}
if (hBitmap)
{
static const TCHAR keyword[] = TEXT("<java logo>");
static const UINT keywordLen = COUNT(keyword)-1;
FINDTEXT find;
ZeroMemory(&find, sizeof(find));
find.chrg.cpMax = -1;
find.lpstrText = (LPTSTR)keyword;
SendMessage(hText, EM_SETSEL, 0, 0);
int pos = SendMessage(hText,EM_FINDTEXT, FR_MATCHCASE|FR_DOWN,
(LPARAM)&find);
if (pos >= 0) {
IRichEditOle* re = NULL;
SendMessage(hText, EM_GETOLEINTERFACE, 0, (LPARAM)&re);
if (re) {
CImageDataObject* bmp = new CImageDataObject(hBitmap);
if (bmp) {
SendMessage(hText,EM_SETSEL,pos,pos+keywordLen);
bmp->Insert(re);