rvenkat
asked on
OLE container conversion....
How would one write code to change an OLE embedded item to a graphic in an OLE container Applictaion written in MFC C++ using the rich edit control?
(The ctrl+shift+F9 combo in WORD changes an embedded OLE item to a graphic.)
(The ctrl+shift+F9 combo in WORD changes an embedded OLE item to a graphic.)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the CreateStaticFromClipboard( ) function to get a static OLE object that is a particular format you want, but you're not asking for any format in particular since you're passing zero for the clipboard format and NULL for the LPFORMATETC parameter.
Even if you asked for CF_BITMAP, you'd still find that you're creating a static OLE object. Maybe that's what you want: you can paste that into your rich edit control and let the edit control do the work.
Unfortunately, I'm not familiar with the Word command you mention and, in Word 97, it doesn't appear to do anything. But your question led me to believe that you wanted a plain old HBITMAP without OLE involved at all, but maybe that's not the case.
.B ekiM
Even if you asked for CF_BITMAP, you'd still find that you're creating a static OLE object. Maybe that's what you want: you can paste that into your rich edit control and let the edit control do the work.
Unfortunately, I'm not familiar with the Word command you mention and, in Word 97, it doesn't appear to do anything. But your question led me to believe that you wanted a plain old HBITMAP without OLE involved at all, but maybe that's not the case.
.B ekiM
ASKER
I copy the ole item to the clipboard and recreate it as a static object. Is the static object a bitmap/graphic?
//I get the OLE container item
CNOTESCntrItem* pItem = (CNOTESCntrItem *) pDoc->GetNextItem(pos);
//I copy it to the clipboard
pItem->CopyToClipboard();
//then I create a new OLE object
pStaticItem = new CNOTESCntrItem(NULL, GetDocument());
//Then I select the Ole container object in the richedit control
//and delete it
GetRichEditCtrl().SetSel(p
GetRichEditCtrl().Clear();
//Now using the new container itemn object I create a STATIC //object frm the clipboard and insert it. IS THIS WHAT YOU MEAN BY RENDER AS A //BITMAP???
if(pStaticItem->CreateStat
InsertItem(pStaticItem);