Java Variant als Return value

TJY

Grünschnabel
Hallo Leute,

ich habe ein Problem und zwar versuche eine COM-Methode mit Java aufzurufen, die 2 Rückgabewerte mit Datentyp Variant hat. Ich weiß nicht genau wie ich jetzt vorgehen muss. In der API Beschreibung sieht die folgende Methode so aus:

(Interface VisDispMetaDataList )

GetProperty (Long Index, VARIANT strPropName, VARIANT varPropValue)

Gets the specified property from the collection.

Parameters:

Index - The index of the property to retrieve.

strPropName - The variant string name of the returned property.

varPropValue - A variant object containing the return property.


Und mein Code in Java sieht bisher so aus:

int getPropID = metaDataPropOle.getIDsOfNames(new String []{"GetProperty"})[0];
Variant strPropNameIndex = new Variant ("0");

Variant strPropNameList [] = new Variant [] {strPropNameIndex};
Variant instname = metaDataPropOle.invoke(getPropID,strPropNameList);


Bis hierhin komme ich nicht mehr weiter. Wenn ich es richtig verstanden habe, müsste instname 2 Werte enthalten oder? Und wie kann ich sie herholen?

Ich hoffe ihr könnt mir helfen. Danke schon im Voraus.

MfG
TYJ
 
Hallo,

versuchs mal so:
Java:
...
int getPropID = metaDataPropOle.getIDsOfNames(new String []{"GetProperty"})[0];
Variant propertyIndex = new Variant (0L);
Variant propertyName = new Variant ("somePropertyName");
Variant propertyValueOut = new Variant ();
Variant[] args = new Variant[]{propertyIndex,propertyName,propertyValueOut};
Variant invocationResult = metaDataPropOle.invoke(getPropID,args);

//propertyValueOut sollte gemäß der API Doku nun den entsprechenden Wert enthalten.
...


Gruß Tom
 
Zurück