Digi Posted March 12, 2006 Share Posted March 12, 2006 I'm trying to capture events with Java and JACOB Not sure if the code is correct. it throws com.jacob.com.ComFailException: Can't find event iid Any suggestions? try { DVBViewer = ActiveXComponent.connectToActiveInstance( "DVBViewerServer.DVBViewer"); if (DVBViewer == null) { DVBViewer = new ActiveXComponent("DVBViewerServer.DVBViewer"); } Dispatch src = DVBViewer.getProperty("Events").toDispatch(); DVBEvents dvbevents = new DVBEvents(); DispatchEvents de = new DispatchEvents(src,dvbevents); } catch (Exception e) { e.printStackTrace(); } import com.jacob.com.*; import com.jacob.activeX.*; public class DVBEvents { public void OnChannelChange(Variant[] args) { System.out.println("test"); } } additional info http://danadler.com/jacob/ Events The current model is conceptually similar to the Visual Basic WithEvents construct. Basically, I provide a class called com.jacob.com.DispatchEvents which has a constructor that takes a source object (of type com.jacob.com.Dispatch) and a target object (of any type). The source object is queried for its IConnectionPointContainer interface and I attempt to obtain an IConnectionPoint for its default source interface (which I obtain from IProvideClassInfo). At the same time, I also create a mapping of DISPID's for the default source interface to the actual method names. I then use the method names to get jmethodID handles from the target Java object. All event methods currently must have the same signature: one argument which is a Java array of Variants, and a void return type. The dependency on IProvideClassInfo means that the Type Library for the component must exist if you want to support events. Version 1.7 also includes code to read the type library directly from the progid. This makes it possible to work with all the Microsoft Office application events, as well as IE5 events. For an example see the samples/test/IETest.java example. Quote Link to comment
Digi Posted March 15, 2006 Author Share Posted March 15, 2006 Still no go... Dispatch src = DVBViewer.getProperty("Events").toDispatch(); DVBEvents dvbevents = new DVBEvents(); DispatchEvents de = new DispatchEvents(src,dvbevents,"DVBViewerServer.DVBViewer","C:\\Program Files\\DVBViewer\\DVBViewer.exe"); com.jacob.com.ComFailException: Can't FindConnectionPoint at com.jacob.com.DispatchEvents.init3(Native Method) Dispatch src = DVBViewer.QueryInterface("{B397FB16-A027-4D5B-88EB-FD9A2AA28D92}"); DVBEvents dvbevents = new DVBEvents(); DispatchEvents de = new DispatchEvents(src,dvbevents,"DVBViewerServer.DVBViewer","C:\\Program Files\\DVBViewer\\DVBViewer.exe"); com.jacob.com.ComFailException: QI on IID from String Failed at com.jacob.com.Dispatch.QueryInterface(Native Method) I'll try Jacob support forum now... Quote Link to comment
Digi Posted March 27, 2006 Author Share Posted March 27, 2006 My DispatchEvents thread in Jacob Help Forum No solution found there. Suggestion was to use DVBViewer as first parameter, doesn't work either. I'm still totally stuck with this if you can help please do so. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.