有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java遇到COM异常:在调用时:AddItem Description:80004002/不支持此类接口

我试图使用Jacob COM接口从Java应用程序调用C#应用程序的一个函数。我从注册表项中获取了ActiveXComponent。我必须调用一个方法

BaseElement AddItem(
    string name,
    ElementType type
)

这里ElementType是C#应用程序中的ENUM。但是我无法使用invokeGetComponent/getPropertyAsComponent获取elsemnt类型

有趣的是,我可以调用与下面相同的方法

ActiveXComponent appHandler= new ActiveXComponent("Application_name");
ActiveXComponent projectHandler = appHandler.invokeGetComponent("CreateProject", new Variant("C:\\temp"), new Variant("test"));

projectHandler.invokeGetComponent("AddItem", new Variant("item1"),new Variant(0));

此方法使用integer而不是ElementType来执行其任务,但会引发异常

com.jacob.com.ComFailException: A COM exception has been encountered: At Invoke of: AddItem Description: 80004002 / No such interface supported at com.jacob.com.Dispatch.invokev(Native Method) at com.jacob.com.Dispatch.invokev(Dispatch.java:625) at com.jacob.com.Dispatch.callN(Dispatch.java:453) at com.jacob.activeX.ActiveXComponent.invoke(ActiveXComponent.java:476) at com.jacob.activeX.ActiveXComponent.invokeGetComponent(ActiveXComponent.java:391)

是否有任何方法可以获取应用程序中给定的枚举类型ElementType?ElementType似乎位于C#中的另一个命名空间中


共 (0) 个答案