Class COMProxy


  • public class COMProxy
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      VARIANT call​(java.lang.Object disp, int dispid)
      Calls IDispatch::invokev for the property/method exposed by the object.
      VARIANT call​(java.lang.Object disp, int dispid, java.lang.Object a1)
      Calls IDispatch::invoke for the property/method exposed by the object.
      VARIANT call​(java.lang.Object disp, java.lang.String name)
      Provides access to properties and methods exposed by an object.
      VARIANT call​(java.lang.Object disp, java.lang.String name, java.lang.Object a1)
      Calls IDispatch::invoke for the property/method exposed by the object.
      VARIANT call​(java.lang.Object disp, java.lang.String name, java.lang.Object a1, java.lang.Object a2)
      Calls IDispatch::invoke for the property/method exposed by the object.
      VARIANT call​(java.lang.Object disp, java.lang.String name, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3)
      Calls IDispatch::invoke for the property/method exposed by the object.
      VARIANT call​(java.lang.Object disp, java.lang.String name, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4)
      Calls IDispatch::invoke for the property/method exposed by the object.
      static COMProxy create()
      Create singular instance of COMProxy
      IDispatch createInstance​(java.lang.String progID)
      create separate instances of automation object IDispatch
      VARIANT get​(java.lang.Object disp, int dispid)
      Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYGET
      VARIANT get​(java.lang.Object disp, java.lang.String name)
      Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYGET
      int[] getIDsOfNames​(java.lang.Object disp, java.lang.String[] names)
      Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs, which can be used on subsequent calls to IDispatch::Invoke.
      BSTR newBSTR​(java.lang.String data)
      create new BSTR object
      VARIANT newVariant​(int type, java.lang.Object data)
      create VARIANT with specific type
      void put​(java.lang.Object disp, int dispid, java.lang.Object val)
      Calls IDispatch::invoke for the property exposed by the object with wFlags = DISPATCH_PROPERTYPUT
      void put​(java.lang.Object disp, java.lang.String name, java.lang.Object val)
      Calls IDispatchinvoke for the property exposed by the object with wFlags = DISPATCH_PROPERTYPUT
      void putRef​(java.lang.Object disp, int dispid, java.lang.Object val)
      Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYPUTREF
      void putRef​(java.lang.Object disp, java.lang.String name, java.lang.Object val)
      Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYPUTREF
      java.lang.Object QueryInterface​(java.lang.Object disp, java.lang.String iid)
      calls IDispatch object's QueryInterface
      void release​(java.lang.Object disp)
      call this to explicitly release the com object before gc
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • create

        public static COMProxy create()
                               throws java.lang.Exception
        Create singular instance of COMProxy
        Returns:
        singular COMProxy instance null if running on a non windows machine COMProxy does not make sense on a non windows machine
        Throws:
        java.lang.Exception
      • createInstance

        public IDispatch createInstance​(java.lang.String progID)
        create separate instances of automation object IDispatch
        Parameters:
        progID - program identifier
        Returns:
        IDispatch object
      • QueryInterface

        public java.lang.Object QueryInterface​(java.lang.Object disp,
                                               java.lang.String iid)
                                        throws COMError
        calls IDispatch object's QueryInterface
        Parameters:
        disp - IDispatch object
        iid - Identifier of the interface being requested
        Returns:
        Returns pointers to supported interfaces
        Throws:
        COMError
      • release

        public void release​(java.lang.Object disp)
                     throws COMError
        call this to explicitly release the com object before gc
        Parameters:
        disp - IDispatch object that needs to be released
        Throws:
        COMError
      • getIDsOfNames

        public int[] getIDsOfNames​(java.lang.Object disp,
                                   java.lang.String[] names)
                            throws COMError
        Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs, which can be used on subsequent calls to IDispatch::Invoke.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        names - array of method names
        Returns:
        disp ID's of methods
        Throws:
        COMError
      • call

        public VARIANT call​(java.lang.Object disp,
                            java.lang.String name)
                     throws COMError
        Provides access to properties and methods exposed by an object.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the method/property to be invoked.
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • call

        public VARIANT call​(java.lang.Object disp,
                            java.lang.String name,
                            java.lang.Object a1)
                     throws COMError
        Calls IDispatch::invoke for the property/method exposed by the object.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the method/property to be invoked.
        a1 -
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • call

        public VARIANT call​(java.lang.Object disp,
                            java.lang.String name,
                            java.lang.Object a1,
                            java.lang.Object a2)
                     throws COMError
        Calls IDispatch::invoke for the property/method exposed by the object.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the method/property to be invoked.
        a1 -
        a2 -
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • call

        public VARIANT call​(java.lang.Object disp,
                            java.lang.String name,
                            java.lang.Object a1,
                            java.lang.Object a2,
                            java.lang.Object a3)
                     throws COMError
        Calls IDispatch::invoke for the property/method exposed by the object.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the method/property to be invoked.
        a1 -
        a2 -
        a3 -
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • call

        public VARIANT call​(java.lang.Object disp,
                            java.lang.String name,
                            java.lang.Object a1,
                            java.lang.Object a2,
                            java.lang.Object a3,
                            java.lang.Object a4)
                     throws COMError
        Calls IDispatch::invoke for the property/method exposed by the object.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the method/property to be invoked.
        a1 -
        a2 -
        a3 -
        a4 -
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • call

        public VARIANT call​(java.lang.Object disp,
                            int dispid)
                     throws COMError
        Calls IDispatch::invokev for the property/method exposed by the object.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        dispid - Identifies the member. Use GetIDsOfNames or the object's documentation to obtain the dispatch identifier
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • call

        public VARIANT call​(java.lang.Object disp,
                            int dispid,
                            java.lang.Object a1)
                     throws COMError
        Calls IDispatch::invoke for the property/method exposed by the object.
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        dispid - Identifies the member. Use GetIDsOfNames or the object's documentation to obtain the dispatch identifier
        a1 -
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • put

        public void put​(java.lang.Object disp,
                        java.lang.String name,
                        java.lang.Object val)
                 throws COMError
        Calls IDispatchinvoke for the property exposed by the object with wFlags = DISPATCH_PROPERTYPUT
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the property
        val - value to be set
        Throws:
        COMError
      • put

        public void put​(java.lang.Object disp,
                        int dispid,
                        java.lang.Object val)
                 throws COMError
        Calls IDispatch::invoke for the property exposed by the object with wFlags = DISPATCH_PROPERTYPUT
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        dispid - Identifies the member. Use GetIDsOfNames or the object's documentation to obtain the dispatch identifier
        val -
        Throws:
        COMError
      • get

        public VARIANT get​(java.lang.Object disp,
                           java.lang.String name)
                    throws COMError
        Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYGET
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the method/property to be invoked.
        Returns:
        return value of the method invoked
        Throws:
        COMError
      • get

        public VARIANT get​(java.lang.Object disp,
                           int dispid)
                    throws COMError
        Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYGET
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        dispid - Identifies the member. Use GetIDsOfNames or the object's documentation to obtain the dispatch identifier
        Returns:
        value of the property
        Throws:
        COMError
      • putRef

        public void putRef​(java.lang.Object disp,
                           java.lang.String name,
                           java.lang.Object val)
                    throws COMError
        Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYPUTREF
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        name - name of the method/property to be invoked.
        val - value of the property
        Throws:
        COMError
      • putRef

        public void putRef​(java.lang.Object disp,
                           int dispid,
                           java.lang.Object val)
                    throws COMError
        Calls IDispatch::invoke for the property exposed by the object, with wFlags=DISPATCH_PROPERTYPUTREF
        Parameters:
        disp - java IDispatch(or COMProxy) object, obtained as a result of system.createCOMInstance(String progID)
        dispid - Identifies the member. Use GetIDsOfNames or the object's documentation to obtain the dispatch identifier
        val - value of the property
        Throws:
        COMError
      • newVariant

        public VARIANT newVariant​(int type,
                                  java.lang.Object data)
                           throws COMError
        create VARIANT with specific type
        Parameters:
        type - refer to the COMConstant types
        data - data
        Returns:
        VARIANT object
        Throws:
        COMError
      • newBSTR

        public BSTR newBSTR​(java.lang.String data)
                     throws COMError
        create new BSTR object
        Parameters:
        data - string
        Returns:
        BSTR object
        Throws:
        COMError