locked
about Inplace activation (OLE 2.0 editing) RRS feed

  • Question

  • Hi all.

     

    I have a question about Inplace activation.

    I want to open excel file and show excel UI as COM out process server for user editing in my application.

    I will integrate Excel UI into my application by using Inplace activation system.

     

    What I want to do is to develop COM client like Internet Explorer which show integrated UI when user drop excel file into it.

    (but I do not want to use IE components(i.e. WebBrowser control))

     

    I tried Inplace activation, but it did not work.

    My tring was following... 

     

    1.Search ProgID from registry by filename extension(.xls)

    2.Convert ProgID to ClassID

    3.Call CreateInstance(...,CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,IID_IOleObject,...)

    4.Create IOleDocumentSite,IOleClientSite,IAdviseSink2 instance

    5.Call IOleObject::SetClientSite to set IOleClientSite instance

      COM Server query IOleDocumentSite interface at this time, I return IOleDocumentSite instance

    6.Call IOleObject::Advise to set IAdviseSink2

    7.Query IPersistFile interface from IOleObject to load excel file

    8.Call IPersistFile::Load(filename,STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT)

    9.Query IOleDocument and IOleInPlaceObject from IOleObject

    10.Create IOleInPlaceSiteEx instance

    11.Call IOleDocument::CreateView(IOleInPlaceSiteEx,NULL,0,&IOleDocumentView)

      Error occurs here. 

      Result value of this method is E_UNEXPECTED.

     

    Would you please give me some advice ?

    Friday, October 29, 2010 2:03 PM

All replies

  • After changing IOleInPlaceSiteEx to IOleInPlaceSite, it went well.

    It seems that Marshaling of IOleInPlaceSiteEx fails in CreateView.

    I do not prepare custom marshaling for IOleInPlaceSiteEx, and when COM system query IMarshal interface, My implementation of IOleInPlaceSiteEx::QueryInterface return E_NOINTERFACE.

    So COM default implementation should be used.

    I tried CoMarshalInterface(...,MSHCTX_LOCAL,NULL,MSHLFLAGS_NORMAL) to marshal IOleInPlaceSiteEx, it failed and result was E_UNEXPECTED.

    Maybe COM default implementation do not support IOleInPlaceSiteEx marshaling ? Or my implementation is wrong ?

    Because I can not figure out reason, I will consider to use IOleInPlaceSite instead of Ex.

    Wednesday, November 3, 2010 12:58 AM