Click here to Skip to main content
15,915,324 members
Home / Discussions / COM
   

COM

 
GeneralRe: Is it possible for reflections for COM Exe or COM DLL? Pin
glitteringsound10-Mar-10 2:19
glitteringsound10-Mar-10 2:19 
GeneralRe: Is it possible for reflections for COM Exe or COM DLL? Pin
Jürgen Jung10-Mar-10 2:21
Jürgen Jung10-Mar-10 2:21 
GeneralRe: Is it possible for reflections for COM Exe or COM DLL? Pin
glitteringsound10-Mar-10 7:51
glitteringsound10-Mar-10 7:51 
QuestionUnable to update system registry Pin
Pryabu9-Mar-10 0:03
Pryabu9-Mar-10 0:03 
AnswerRe: Unable to update system registry Pin
Jonathan Davies9-Mar-10 2:19
Jonathan Davies9-Mar-10 2:19 
QuestionHide InDesign Application while Its Instance is created Pin
Rashmi_Karnam2-Mar-10 18:58
Rashmi_Karnam2-Mar-10 18:58 
QuestionTrouble with UrlDownloadToFile in Firefox Pin
GamerGoon1-Mar-10 1:18
GamerGoon1-Mar-10 1:18 
Questionhow to pre-define a com interface in a idl file? Pin
kcynic28-Feb-10 18:32
kcynic28-Feb-10 18:32 
AnswerRe: how to pre-define a com interface in a idl file? Pin
Stuart Dootson28-Feb-10 23:42
professionalStuart Dootson28-Feb-10 23:42 
GeneralRe: how to pre-define a com interface in a idl file? Pin
kcynic1-Mar-10 20:50
kcynic1-Mar-10 20:50 
QuestionNeed help to write a COM component which should be accessible from JScript! Pin
gopikomanduri26-Feb-10 7:29
gopikomanduri26-Feb-10 7:29 
AnswerRe: Need help to write a COM component which should be accessible from JScript! Pin
cariolihome26-Feb-10 23:27
cariolihome26-Feb-10 23:27 
AnswerRe: Need help to write a COM component which should be accessible from JScript! Pin
«_Superman_»28-Feb-10 17:14
professional«_Superman_»28-Feb-10 17:14 
QuestionHow to load a CRichEditCtrl with RTF containing embedded objects. Pin
Leif Goodwin26-Feb-10 3:30
Leif Goodwin26-Feb-10 3:30 
I have a class called CReportEditCtrl derived from CRichEditCtrl which allows me to programmatically insert an embedded object (OLE mini-server) into the document. This is based on code here:

A Rich Edit Control That Displays Bitmaps and Other OLE Objects[^]

Embedding is simple enough:

CComPtr<IRichEditOle> pIRichEditOle = GetIRichEditOle();

CLSID classId;
HRESULT hr = ::CLSIDFromProgID(L"EmbeddedLink.Document", &classId);
if (hr == S_OK)
{
// Get the OLE client site from the container
CComPtr<IOleClientSite> pIOleClientSite;
hr = pIRichEditOle->GetClientSite(&pIOleClientSite);
if (hr != S_OK)
{
return(false);
}

// Get storage from the container
CComPtr<IStorage> pIStorage;
hr = m_pIRichEditOleCallback->GetNewStorage(&pIStorage);
if (hr != S_OK)
{
return(false);
}

// Create an OLE object i.e. the embedded item
CComPtr<IOleObject> pIOleObject;
hr = ::OleCreate(
classId,
IID_IOleObject,
OLERENDER_DRAW,
NULL,
pIOleClientSite,
pIStorage,
(void**)&pIOleObject);
if (hr != S_OK)
{
return(false);
}

CDataObject *pDataObject = new CDataObject;
pDataObject->AddRef();
pDataObject->Populate(strText);
hr = pIOleObject->InitFromData(pDataObject, 0, 0);
pDataObject->Release();
if (hr != S_OK)
{
return(false);
}

REOBJECT reObject;
memset(&reObject, 0, sizeof(reObject));
reObject.cbStruct = sizeof(reObject);
reObject.cp = CharFromPos(point);
reObject.clsid = classId;
reObject.poleobj = pIOleObject;
reObject.polesite = pIOleClientSite;
reObject.pstg = pIStorage;
reObject.dvaspect = DVASPECT_CONTENT;
reObject.dwFlags = REO_INPLACEACTIVE|REO_DYNAMICSIZE;
hr = pIRichEditOle->InsertObject(&reObject);

m_arrayIOleObject.insert(m_arrayIOleObject.end(), pIOleObject.Detach());
}

When I stream out the RTF, it looks great, with embedded objects as expected. When I stream the RTF into a new object of the CReportEditCtrl class, the objects are displayed in the new control, but when I look at process explorer, the mini-server is not running. When I stream out the RTF, each embeddeded object has gone, and has been replaced by its metafile, allowing it to be drawn, but all knowledge of the object has gone. What it going on? It looks as if the CRichEditCtrl instance has not loaded the embedded obejcts when the RTF data was streamed in. I thought the CRichEditCtrl was supposed to handle loading RTF containing embedded objects?

Incidentally, I get the same result with only one CReportEditCtrl instance if I stream out the RTF, stream it back in, and then stream it out again. The embedded objects are lost.

Help appreciated.
AnswerRe: How to load a CRichEditCtrl with RTF containing embedded objects. [modified] Pin
Leif Simon Goodwin27-Feb-10 1:33
Leif Simon Goodwin27-Feb-10 1:33 
AnswerRe: How to load a CRichEditCtrl with RTF containing embedded objects. Pin
Leif Simon Goodwin2-Apr-10 0:40
Leif Simon Goodwin2-Apr-10 0:40 
QuestionRun Only One Instance Of AddOn In Multiple IE Win Pin
A_Fa24-Feb-10 3:09
A_Fa24-Feb-10 3:09 
AnswerRe: Run Only One Instance Of AddOn In Multiple IE Win Pin
KarstenK24-Feb-10 3:40
mveKarstenK24-Feb-10 3:40 
AnswerRe: Run Only One Instance Of AddOn In Multiple IE Win Pin
R@jeev K R7-Mar-10 19:43
R@jeev K R7-Mar-10 19:43 
Questioncom memory management Pin
ramina sen23-Feb-10 21:15
ramina sen23-Feb-10 21:15 
AnswerRe: com memory management Pin
Richard MacCutchan23-Feb-10 22:00
mveRichard MacCutchan23-Feb-10 22:00 
AnswerRe: com memory management Pin
KarstenK24-Feb-10 4:20
mveKarstenK24-Feb-10 4:20 
QuestionFew basics about COM Pin
tasumisra21-Feb-10 18:09
tasumisra21-Feb-10 18:09 
AnswerRe: Few basics about COM Pin
Richard MacCutchan21-Feb-10 21:55
mveRichard MacCutchan21-Feb-10 21:55 
Questionhandle DISPID_NEWWINDOW2 or 3 Pin
rustok19-Feb-10 21:46
rustok19-Feb-10 21:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.