Exception in thread "main" java.lang.IllegalStateException: Type not supported: 13
at com.sun.jna.platform.win32.OaIdlUtil.toPrimitiveArray(OaIdlUtil.java:272)
at com.sun.jna.platform.win32.OaIdlUtil.toPrimitiveArray(OaIdlUtil.java:284)
at com.sun.jna.platform.win32.OaIdlUtil.toPrimitiveArray(OaIdlUtil.java:176)
at test.Import.main(Import.java:153)
when running this code:
SAFEARRAY sa= new SAFEARRAY(pbr3.getValue());
Object[] objectResult = (Object[]) OaIdlUtil.toPrimitiveArray(sa, false);
When I loop through, the cause of the error are text cells (or at least they appear to be when accessed in Excel).
How can I debug this?
Thanks,
Oyvind
Hi,
OleAuto.INSTANCE.VariantChangeType(var, var,(short) 1, new VARTYPE(Variant.VT_BSTR));
System.out.println(var.getVarType());
Exception in thread "main" com.sun.jna.platform.win32.COM.COMException: Bad variable type.(HRESULT: 80020008) (puArgErr=)
at com.sun.jna.platform.win32.COM.COMUtils.checkRC(COMUtils.java:131)
at com.sun.jna.platform.win32.COM.COMUtils.checkRC(COMUtils.java:108)
HRESULT Func(
[in] BSTR str1,
[in] BSTR str2,
[in] BSTR str3,
[out, retval] HRESULT* retVal);
return f.invokeInt(new Object[]{myInterfacePointer
,"aa","bb","cc"
});
HRESULT Func(
[in] BSTR str1,
[in] BSTR str2,
[in] BSTR str3,
[out, retval] HRESULT* retVal);
returnf.invokeInt(new Object[]{myInterfacePointer
,"aa","bb","cc"
});
Hey,
Am Freitag, den 02.06.2017, 07:44 -0700 schrieb Oyvind Foshaug:
> Update Functions work properly, and I cannot reproduce the error I am
> afraid. The Unknown problem I experience with the real interface has
> to do something about the formatting of the cells in the object
> array, But what it is I do not know (Ive tried different characters
> etc ).
> Any ideas?
No, sorry. You can try to ask the producer of the library what goes on.
The documentation for VariantChangeType has to say:
An object is coerced to a value by invoking the object's Value
property (DISPID_VALUE).
So if the IUnknown you retrieve is either not a IDispatch or does not
handle the DISPID_VALUE.
Matthias
returnf.invokeInt(new Object[]{myInterfacePointer
,"aa","bb","cc"
});
should be
returnf.invokeInt(new Object[]{myInterfacePointer
,new BSTR("aa"),new BSTR("bb"),new BSTR("cc")
});
Thanks
Oyvind
Op woensdag 7 juni 2017 09:33:09 UTC+2 schreef nyholku: