Menu

problem in attaching event interface

Ravindra A
2011-03-08
2012-11-29
  • Ravindra A

    Ravindra A - 2011-03-08

    Hi all,

    I'm having a problem in attaching event interface.

    Following is my DLL

    // Generated .IDL file (by the OLE/COM Object Viewer)
    //
    // typelib filename: JaiGanesh.dll

    [
      uuid(E1F0FA94-7379-45A9-96F8-71FDAF210567),
      version(1.0),
      helpstring("JaiGanesh 1.0 Type Library")
    ]
    library JAIGANESHLib
    {
        // TLib :     // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
        importlib("stdole2.tlb");

        // Forward declare all types defined in this typelib
        dispinterface MyEventInterface;

        [
          uuid(1F8C0130-CDF5-11D3-B77E-00104BDC292F),
          helpstring("MyEventInterface Interface")
        ]
        dispinterface MyEventInterface {
            properties:
            methods:
               
                HRESULT sayHello();
        };
    };

    Following is the code used to attach event interface,

    String uuid ="1F8C0130-CDF5-11D3-B77E-00104BDC292F";

    JILocalCoClass javaComponent = new JILocalCoClass(new JILocalInterfaceDefinition(uuid),MyEventInterface.class);

    JILocalParamsDescriptor simpleTestMethod1 = new JILocalParamsDescriptor();
    simpleTestMethod1.addInParamAsType(JIString.class,JIFlags.FLAG_NULL);
    JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("sayHello",1,simpleTestMethod1);
    javaComponent.getInterfaceDefinition().addMethodDescriptor(methodDescriptor);

    ArrayList list = new ArrayList();
    list.add(uuid);
    //list.add("00020400-0000-0000-c000-000000000046");//IDispatch
    javaComponent.setSupportedEventInterfaces(list);

    IJIComObject test = JIObjectFactory.buildObject(session,javaComponent);
    identifier = JIObjectFactory.attachEventHandler(msWord,uuid,test);

    I'm getting following error at line JIObjectFactory.attachEventHandler(msWord,uuid,test); in above code,

    org.jinterop.dcom.common.JIException: Message not found for errorCode: 0x80040200

    How to resolve this error?

     
  • Vikram Roopchand

    Hi,
         Does MS Word support this connection point ? You can only add those which are supported in its IDL. Google for this error code. Though I think it means that COM server could not find a connection point with your Id.

    thanks,
    best regards,
    Vikram

     

Log in to post a comment.