Re: error in HostItemProvider::GetHostobject

  •  02-08-2007, 10:31 AM

    Re: error in HostItemProvider::GetHostobject

    Hi Hyun,

    The ShapeAppVBA sample uses APC and supports a more sophisticated COM implementation including Dual interfaces for strong-typed.  The ShapeAppMFC app does not have this support -- it only provides type info via the MFC macros mentioned.  

    Notice this part of the stdafx.h in ShapeAppVBA:

    #include "ShapeAppVBA_tlb.h"

    #include "MFCDUAL.h"

    #include "resource.h"

    #define IfNullRetHR(expr, code) { if (!(expr)) return code; }

    #define IfFailRet(expr) { hr = (expr); if (FAILED(hr)) return hr; }

    #define APC_FORCE_RELEASE

    //#define APC_FORCE_DEBUG

    #include <apcdual.h>

    using namespace MSAPC;

    #define APC_IMPORT_MIDL

    #include <apcmfc.h>

    using namespace MSAPC;

    EXTERN_C const GUID CLSID_ShapeAppControlLibrary;

    ===========

    And notice that the type library is included as a resource in the .RC file

    "1 TYPELIB ""ShapeAppVBA.tlb""\r\n"

    Are you using APC in your VBA-enable app?

    You should follow the ShapeAppVBA sample which includes a walkthrough document that states:

    When you build the solution, a type library named ShapeAppVBA.tlb is created in the %SYSTEMDRIVE%\VSTA\ShapeAppVBA\Core\Debug directory. You will use this type library in the “Creating the Proxy Source DLL” section of this walkthrough.

     

    Follow the walkthrough, and I think that you will make good progress integrating VSTA

    Regards,

    Gary

     

    Filed under:
View Complete Thread