ActiveX Controls Technical Articles OLE Controls: Registration Insertable OLE objects that can be embedded include the Insertable key in their class registry entry. OLE servers such as Microsoft Excel, Word, and Scribble include this key when they register. The Insert Object command in Word uses this key to fill a list box with the names of objects that you can embed within your document.OLE Controls may or may not include the Insertable key. The control developer will not define this key if inserting the control (for example, a timer) into a document does not make any sense. If the control developer wants to use the control with OLE containers that do not support OLE Controls directly, the control will have an Insertable key. Including this key indicates that the control is compatible with existing OLE containers. ControlWizard does not define the Insertable key by default. The code shown below for Spindial from SPINCTL.CPP determines whether the control can be inserted. Change FALSE to TRUE (see the line in bold below) if you would like to insert your control.BOOL CSpindialCtrl::CSpindialCtrlFactory::UpdateRegistry(BOOL bRegister) { if (bRegister) return AfxOleRegisterControlClass( AfxGetInstanceHandle(), m_clsid, m_lpszProgID, IDS_SPINDIAL, IDB_SPINDIAL, FALSE, // Not insertable _dwSpindialOleMisc, _tlid, _wVerMajor, _wVerMinor); else return AfxOleUnregisterClass(m_clsid, m_lpszProgID); }
Insertable
OLE objects that can be embedded include the Insertable key in their class registry entry. OLE servers such as Microsoft Excel, Word, and Scribble include this key when they register. The Insert Object command in Word uses this key to fill a list box with the names of objects that you can embed within your document.OLE Controls may or may not include the Insertable key. The control developer will not define this key if inserting the control (for example, a timer) into a document does not make any sense. If the control developer wants to use the control with OLE containers that do not support OLE Controls directly, the control will have an Insertable key. Including this key indicates that the control is compatible with existing OLE containers. ControlWizard does not define the Insertable key by default. The code shown below for Spindial from SPINCTL.CPP determines whether the control can be inserted. Change FALSE to TRUE (see the line in bold below) if you would like to insert your control.BOOL CSpindialCtrl::CSpindialCtrlFactory::UpdateRegistry(BOOL bRegister)
{
if (bRegister)
return AfxOleRegisterControlClass(
AfxGetInstanceHandle(),
m_clsid,
m_lpszProgID,
IDS_SPINDIAL,
IDB_SPINDIAL, FALSE, // Not insertable _dwSpindialOleMisc,
_tlid,
_wVerMajor,
_wVerMinor);
else
return AfxOleUnregisterClass(m_clsid, m_lpszProgID);
}
return AfxOleRegisterControlClass(
AfxGetInstanceHandle(),
m_clsid,
m_lpszProgID,
IDS_WEBPRINT,
IDB_WEBPRINT,
afxRegApartmentThreading,
_dwWebPrintOleMisc,
_tlid,
_wVerMajor,
_wVerMinor);
AfxGetInstanceHandle(),
m_clsid,
m_lpszProgID,
IDS_WEBPRINT,
IDB_WEBPRINT,
afxRegInsertable | afxRegApartmentThreading,
_dwWebPrintOleMisc,
_tlid,
_wVerMajor,
_wVerMinor);