出现在word->插入->对象菜单中的控件有什么特殊性?好象一般的ocx控件,即使注册了,在该列表中也没有,但有的ocx就可以。

解决方案 »

  1.   

    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);
    }
      

  2.   

    我用mfc 向导生成的activex控件,怎么没那个选项?
    return AfxOleRegisterControlClass(
    AfxGetInstanceHandle(),
    m_clsid,
    m_lpszProgID,
    IDS_WEBPRINT,
    IDB_WEBPRINT,
    afxRegApartmentThreading,
    _dwWebPrintOleMisc,
    _tlid,
    _wVerMajor,
    _wVerMinor);
      

  3.   

    return AfxOleRegisterControlClass(
    AfxGetInstanceHandle(),
    m_clsid,
    m_lpszProgID,
    IDS_WEBPRINT,
    IDB_WEBPRINT,
    afxRegInsertable | afxRegApartmentThreading,
    _dwWebPrintOleMisc,
    _tlid,
    _wVerMajor,
    _wVerMinor);