2

I'm trying to use JACOB to obtain a callback whenever a slide show starts or ends using the following:

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");
    }
}

However, I'm coming a bit unstuck, the result of the above is:

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)

Does anyone have any ideas? Searching has come up pretty short. I've tried using the 4 argument constructor of DispatchEvents, supplying "Powerpoint.Application" and the full path to the powerpoint exe as the last two arguments, but no difference.

Michael Berry
  • 70,193
  • 21
  • 157
  • 216

0 Answers0