Search in sources :

Example 11 with Factory

use of com.sun.jna.platform.win32.COM.util.Factory in project jna by java-native-access.

the class ProxyObject method getProperty.

@Override
public <T> T getProperty(Class<T> returnType, DISPID dispID, Object... args) {
    VARIANT[] vargs;
    if (null == args) {
        vargs = new VARIANT[0];
    } else {
        vargs = new VARIANT[args.length];
    }
    for (int i = 0; i < vargs.length; ++i) {
        vargs[i] = Convert.toVariant(args[i]);
    }
    Variant.VARIANT.ByReference result = new Variant.VARIANT.ByReference();
    WinNT.HRESULT hr = this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result, this.getRawDispatch(), dispID, vargs);
    for (int i = 0; i < vargs.length; i++) {
        // Free value allocated by Convert#toVariant
        Convert.free(vargs[i], args[i]);
    }
    COMUtils.checkRC(hr);
    return (T) Convert.toJavaObject(result, returnType, factory, false, true);
}
Also used : Variant(com.sun.jna.platform.win32.Variant) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) WinNT(com.sun.jna.platform.win32.WinNT) VARIANT(com.sun.jna.platform.win32.Variant.VARIANT) WinNT(com.sun.jna.platform.win32.WinNT) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) VARIANT(com.sun.jna.platform.win32.Variant.VARIANT) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) DISPIDByReference(com.sun.jna.platform.win32.OaIdl.DISPIDByReference) PointerByReference(com.sun.jna.ptr.PointerByReference) IntByReference(com.sun.jna.ptr.IntByReference) ConnectionPoint(com.sun.jna.platform.win32.COM.ConnectionPoint)

Aggregations

VARIANT (com.sun.jna.platform.win32.Variant.VARIANT)5 Factory (com.sun.jna.platform.win32.COM.util.Factory)4 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)4 PointerByReference (com.sun.jna.ptr.PointerByReference)4 File (java.io.File)4 Variant (com.sun.jna.platform.win32.Variant)3 ConnectionPoint (com.sun.jna.platform.win32.COM.ConnectionPoint)2 ComExcel_Application (com.sun.jna.platform.win32.COM.util.office.excel.ComExcel_Application)2 ComIApplication (com.sun.jna.platform.win32.COM.util.office.excel.ComIApplication)2 ComIWorkbook (com.sun.jna.platform.win32.COM.util.office.excel.ComIWorkbook)2 ComIWorksheet (com.sun.jna.platform.win32.COM.util.office.excel.ComIWorksheet)2 ComIApplication (com.sun.jna.platform.win32.COM.util.office.word.ComIApplication)2 ComWord_Application (com.sun.jna.platform.win32.COM.util.office.word.ComWord_Application)2 IID (com.sun.jna.platform.win32.Guid.IID)2 REFIID (com.sun.jna.platform.win32.Guid.REFIID)2 DISPIDByReference (com.sun.jna.platform.win32.OaIdl.DISPIDByReference)2 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)2 LCID (com.sun.jna.platform.win32.WinDef.LCID)2 WinNT (com.sun.jna.platform.win32.WinNT)2 IntByReference (com.sun.jna.ptr.IntByReference)2