JACOB活动注册

时间:2013-07-15 01:20:45

标签: java events powerpoint jacob

我正在尝试使用JACOB在幻灯片放映开始或结束时使用以下内容获取回调:

public class Test {

    public static void main(String[] args) {
        ActiveXComponent oApp = new ActiveXComponent("PowerPoint.Application");
        Dispatch presentations = oApp.getProperty("Presentations").toDispatch();
        Dispatch presentation = Dispatch.call(presentations, "Open", "C:\\Users\\Bob\\Documents\\test.ppt").toDispatch();
        new DispatchEvents(oApp, new Handler());
    }

}

public class Handler {
    public void SlideShowBegin(Variant[] args) {
        System.out.println("here");
    }
}

然而,我有点失意,上面的结果是:

GetEventIID: couldn't get IProvideClassInfo
Exception in thread "main" com.jacob.com.ComFailException: Can't find event iid
at com.jacob.com.DispatchEvents.init3(Native Method)
at com.jacob.com.DispatchEvents.<init>(DispatchEvents.java:138)
at com.jacob.com.DispatchEvents.<init>(DispatchEvents.java:99)
at com.jacob.com.DispatchEvents.<init>(DispatchEvents.java:72)
at tester.Test.main(Test.java:28)

有没有人有任何想法?搜索已经很短了。我尝试使用DispatchEvents的4参数构造函数,提供“Powerpoint.Application”和powerpoint exe的完整路径作为最后两个参数,但没有区别。

0 个答案:

没有答案