Click here to Skip to main content
15,795,942 members
Home / Discussions / COM
   

COM

 
QuestionTrouble with UrlDownloadToFile in Firefox Pin
GamerGoon1-Mar-10 2:18
GamerGoon1-Mar-10 2:18 
Questionhow to pre-define a com interface in a idl file? Pin
kcynic28-Feb-10 19:32
kcynic28-Feb-10 19:32 
AnswerRe: how to pre-define a com interface in a idl file? Pin
Stuart Dootson1-Mar-10 0:42
professionalStuart Dootson1-Mar-10 0:42 
GeneralRe: how to pre-define a com interface in a idl file? Pin
kcynic1-Mar-10 21:50
kcynic1-Mar-10 21:50 
QuestionNeed help to write a COM component which should be accessible from JScript! Pin
gopikomanduri26-Feb-10 8:29
gopikomanduri26-Feb-10 8:29 
AnswerRe: Need help to write a COM component which should be accessible from JScript! Pin
cariolihome27-Feb-10 0:27
cariolihome27-Feb-10 0:27 
AnswerRe: Need help to write a COM component which should be accessible from JScript! Pin
«_Superman_»28-Feb-10 18:14
professional«_Superman_»28-Feb-10 18:14 
QuestionHow to load a CRichEditCtrl with RTF containing embedded objects. Pin
Leif Goodwin26-Feb-10 4:30
Leif Goodwin26-Feb-10 4: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 2:33
Leif Simon Goodwin27-Feb-10 2:33 
AnswerRe: How to load a CRichEditCtrl with RTF containing embedded objects. Pin
Leif Simon Goodwin2-Apr-10 1:40
Leif Simon Goodwin2-Apr-10 1:40 
QuestionRun Only One Instance Of AddOn In Multiple IE Win Pin
A_Fa24-Feb-10 4:09
A_Fa24-Feb-10 4:09 
AnswerRe: Run Only One Instance Of AddOn In Multiple IE Win Pin
KarstenK24-Feb-10 4:40
mveKarstenK24-Feb-10 4:40 
AnswerRe: Run Only One Instance Of AddOn In Multiple IE Win Pin
R@jeev K R7-Mar-10 20:43
R@jeev K R7-Mar-10 20:43 
Questioncom memory management Pin
ramina sen23-Feb-10 22:15
ramina sen23-Feb-10 22:15 
AnswerRe: com memory management Pin
Richard MacCutchan23-Feb-10 23:00
mveRichard MacCutchan23-Feb-10 23:00 
AnswerRe: com memory management Pin
KarstenK24-Feb-10 5:20
mveKarstenK24-Feb-10 5:20 
QuestionFew basics about COM Pin
tasumisra21-Feb-10 19:09
tasumisra21-Feb-10 19:09 
AnswerRe: Few basics about COM Pin
Richard MacCutchan21-Feb-10 22:55
mveRichard MacCutchan21-Feb-10 22:55 
Questionhandle DISPID_NEWWINDOW2 or 3 Pin
rustok19-Feb-10 22:46
rustok19-Feb-10 22:46 
AnswerRe: handle DISPID_NEWWINDOW2 or 3 Pin
0day7-Mar-10 22:46
0day7-Mar-10 22:46 
QuestionCOM objects to capture screen Pin
Alexandr Kucher18-Feb-10 10:26
Alexandr Kucher18-Feb-10 10:26 
AnswerRe: COM objects to capture screen Pin
«_Superman_»18-Feb-10 19:10
professional«_Superman_»18-Feb-10 19:10 
GeneralRe: COM objects to capture screen Pin
Alexandr Kucher19-Feb-10 2:27
Alexandr Kucher19-Feb-10 2:27 
QuestionProblem in Using the Custom made OCX Pin
quantimizer18-Feb-10 4:35
quantimizer18-Feb-10 4:35 
AnswerRe: Problem in Using the Custom made OCX Pin
Jonathan Davies18-Feb-10 6:51
Jonathan Davies18-Feb-10 6:51 

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.