Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [OLEAutomation]retrieving data from a VT_ARRAY ([OLEAutomation]retrieving data from a VT_ARRAY)
[OLEAutomation]retrieving data from a VT_ARRAY [message #903383] Thu, 23 August 2012 08:50
Shailesh Charati is currently offline Shailesh Charati
Messages: 5
Registered: February 2011
Junior Member
hi!

I am calling following Visio API :

signature from typelib:
[id(0x600200b4), propget, helpcontext(0x00abda01)]
HRESULT MemberOfContainers([out, retval] SAFEARRAY(long)* pContainedByList);

Java wrapper for the same is :

public long[] MemberOfContainers() {
//Property Get
Variant varInputArray[] = new Variant[0];

Variant var = oleAutomation.getProperty(1610743988, varInputArray);

for (Variant _varItr : varInputArray) {
_varItr.dispose();
}
ISafeArrayService safeArrService = (ISafeArrayService) OSGIUtil.getService( Activator.getDefault(), ISafeArrayService.class );
ISafeArray _safeArr = safeArrService.createSafeArray(OLE.VT_I4, var.getByRef());
long[] returnValue = _safeArr.getLongArray();
var.dispose();
return returnValue;

}

The variant "var" returned from oleAutomation.getProperty() call is of type 8195 i.e VT_ARRAY+VT_I4. I have tried to access the address of the array by calling var.getbyRef() and it returns "0".The getbyRef() method under variant is

public int /*long*/ getByRef() {
if (type == COM.VT_EMPTY) {
OLE.error(OLE.ERROR_CANNOT_CHANGE_VARIANT_TYPE, -1);
}
if ((type & COM.VT_BYREF)== COM.VT_BYREF) {
return byRefPtr;
}

return 0;
}

Any suggestion about how do I access the VT_ARRAY ? can we coerce it to VT_BYREF ?

Thanks in advance for your help.

Regards,
-Shailesh
Previous Topic:Adding other controls to a ToolBar
Next Topic:SWT and Java 7
Goto Forum:
  


Current Time: Sat Aug 23 01:51:58 EDT 2014

Powered by FUDForum. Page generated in 0.09625 seconds