SAMPLE: RichEdit.exe - Inserts OLE Object CapabilitiesID: Q141549
|
RichEdit control supports embedding and inplace-activating OLE Objects. To add these capabilities to a RichEdit control in your application, an independent service vendor (ISV) must implement certain OLE interfaces. The RichEdit sample shows how these interfaces are implemented and other implementation details that are required in conjunction with the OLE interfaces to embed and inplace-activate OLE objects.
The following file is available for download from the Microsoft Software
Library:
~ RichEdit.exe
For more information about downloading files from the Microsoft Software
Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
An ISV must implement the following OLE interfaces to add the embedding and
inplace-activating capabilities to the RichEdit control in their
application:
if (m_pRichEditOle)
{
HRESULT hr = 0;
//
// Start by getting the total number of objects in the control.
//
int objectCount = m_pRichEditOle->GetObjectCount();
//
// Loop through each object in the control and if active
// deactivate, and if open, close.
//
for (int i = 0; i < objectCount; i++)
{
REOBJECT reObj;
ZeroMemory(&reObj, sizeof(REOBJECT));
reObj.cbStruct = sizeof(REOBJECT);
//
// Get the Nth object
//
hr = m_pRichEditOle->GetObject(i,&reObj,REO_GETOBJ_POLEOBJ);
if(SUCCEEDED(hr))
{
//
// If active, deactivate.
//
if (reObj.dwFlags && REO_INPLACEACTIVE)
m_pRichEditOle->InPlaceDeactivate();
//
// If the object is open, close it.
//
if(reObj.dwFlags&&REO_OPEN)
hr = reObj.poleobj->Close(OLECLOSE_NOSAVE);
reObj.poleobj->Release();
}
}
m_pRichEditOle->Release();
}
Keywords : kbfile kbsample kbCtrl kbNTOS kbNTOS351 kbRichEdit kbSDKWin32 kbGrpUser kbWinOS95 kbWinOS98
Version :
Platform :
Issue type :
Last Reviewed: March 8, 1999