Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

JComException: IDispatch::Invoke

2008-10-30
2013-04-17
  • Hello,

    I am trying to use jcom to access ActiveX control which manages camera device. The control is named WvnVideo.ocx and in Registry I found CLSID for it WNVVIDEO.WnvVideoCtrl.1. It seems like creating of new Idistapch object goes well, but when I try to call method from ActiveX control I am getting the following error:

    jp.ne.so_net.ga2.no_ji.jcom.JComException: IDispatch::Invoke(0x3E8,1) failed HRESULT=0x8000FFFFL
            at jp.ne.so_net.ga2.no_ji.jcom.IDispatch._invoke(Native Method)
            at jp.ne.so_net.ga2.no_ji.jcom.IDispatch.method(IDispatch.java:223)
            at Camera.login(Camera.java:65)
            at Camera.<init>(Camera.java:28)
            at Camera.getInstance(Camera.java:87)
            at Camera.main(Camera.java:41)

    Here is the part of my class:

    public class Camera {

        private final String DISPATCH_NAME = "WNVVIDEO.WnvVideoCtrl.1";
        private final String FUNCTION_STARTUP = "Startup";
        private final String FUNCTION_SHUTDOWN = "Shutdown";
        private final String FUNCTION_CAPTURE_STILL_TO_FILE = "CaptureStillToFile";
        private final String CODE_OK = "0";

        private static Camera singlton = null;

        private ReleaseManager rm = null;
        private IDispatch app = null;

        private Camera() throws Throwable {
            System.out.println("Camera.konstruktor started");
            rm = new ReleaseManager();
            app = new IDispatch(rm, DISPATCH_NAME);
            login();
        }
    ....
             private synchronized void login() throws Throwable {

            try {
                Object[] param = new Object[] {};

                Long x = (Long) app.method(FUNCTION_STARTUP, param);

                if (!(x != null && x.toString().equals(CODE_OK))) {
                    throw new Exception("Logon na kameru je neuspesan. Povratni kod je " + x);
                }
            } catch (Throwable t) {
                throw t;
            }
        }
    ....
    }

    Does anyone know what may be the problem?