use of com.sun.jna.platform.win32.Variant.VARIANT in project jna by java-native-access.
the class VariantTest method testVariantDate.
public void testVariantDate() {
SYSTEMTIME lpSystemTime = new SYSTEMTIME();
Kernel32.INSTANCE.GetLocalTime(lpSystemTime);
DoubleByReference pvtime = new DoubleByReference();
OleAuto.INSTANCE.SystemTimeToVariantTime(lpSystemTime, pvtime);
VARIANT variantDate = new VARIANT(new DATE(pvtime.getValue()));
}
use of com.sun.jna.platform.win32.Variant.VARIANT in project jna by java-native-access.
the class VariantTest method testVariantSafearrayWrapping.
public void testVariantSafearrayWrapping() {
SAFEARRAY safearray = OaIdl.SAFEARRAY.createSafeArray(new VARTYPE(Variant.VT_I1), 5);
try {
VARIANT variant = new VARIANT(safearray);
assertThat(variant.getVarType().intValue(), equalTo((int) (Variant.VT_I1 | Variant.VT_ARRAY)));
Object wrappedValue = variant.getValue();
assertThat(wrappedValue, instanceOf(SAFEARRAY.class));
assertThat(safearray.getUBound(0), is(4));
} finally {
safearray.destroy();
}
}
use of com.sun.jna.platform.win32.Variant.VARIANT in project jna by java-native-access.
the class VariantTest method testVariantClear.
public void testVariantClear() {
VARIANT variant = new VARIANT(new SHORT(33333));
HRESULT hr = OleAuto.INSTANCE.VariantClear(variant);
assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
}
use of com.sun.jna.platform.win32.Variant.VARIANT in project jna by java-native-access.
the class VariantTest method testVariantCopyShort.
public void testVariantCopyShort() {
VARIANT variantSource = new VARIANT(new SHORT(33333));
VARIANT variantDest = new VARIANT();
//System.out.println(variantSource.toString(true));
HRESULT hr = OleAuto.INSTANCE.VariantCopy(variantDest.getPointer(), variantSource);
assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
}
use of com.sun.jna.platform.win32.Variant.VARIANT in project jna by java-native-access.
the class MSExcel method insertValue.
public void insertValue(String range, String value) throws COMException {
Range pRange = new Range(this.getAutomationProperty("Range", this.getActiveSheet(), new VARIANT(range)));
this.setProperty("Value", pRange, new VARIANT(value));
}
Aggregations