【发布时间】:2019-10-21 07:55:05
【问题描述】:
我尝试使用 jacob 1.19 库将 Java 应用程序与 Bartender Seagull ActiveX 界面集成。我对print 方法有疑问,因为我不知道如何从 jacob 调用此方法。 我尝试了以下代码:
public void print( String printJobName, Boolean waitForSpoolJobToComplete, Integer timeoutMs )
{
Variant args[] = new Variant[ 4 ];
args[ 0 ] = new Variant( printJobName );
args[ 1 ] = new Variant( waitForSpoolJobToComplete );
args[ 2 ] = new Variant( timeoutMs );
args[ 3 ] = new Variant();
args[ 3 ].putNoParam();
Variant ret = format.invoke( "Print", args );
}
其中格式是 .com.jacob.activeX.ActiveXComponent 实例,我得到异常:
遇到了 COM 异常:在调用时:打印说明: 80020005 / 类型不匹配。
我认为 Messages 参数会导致此异常。如何传递这个论点?
【问题讨论】:
-
Messages 是 BarTender
BarTender.Messages下的一个类,我对 jacob 不熟悉,但对您的了解很少代码你需要找到一种方法来获取 classMessagesunderBartender -
可以用jacob检索Messages Object
BarTender.Messages吗? -
我认为更好的办法是检索Messages Collection Object。我试图找回它,但我失败了。我不知道该怎么做。
-
你有类似
ActiveXComponent comp=ActiveXComponent.createNewInstance("BarTender.Application");的东西吗?可以从comp获取Messages Collection吗? -
我有'ActiveXComponent comp = new ActiveXComponent("BarTender.Application");'。它是Application Object,我不知道如何从中获取消息集合对象。我可以获取/设置属性和调用方法,但没有任何方法可以返回消息对象。