Top Description Inners Fields Methods
com.sun.jna.platform.win32

public Interface OleAuto

extends StdCallLibrary
Imports
com.sun.jna.Memory, .Native, .Pointer, .Structure, .Structure.FieldOrder, com.sun.jna.platform.win32.Guid.GUID, .OaIdl.DISPID, .OaIdl.SAFEARRAY, .OaIdl.SAFEARRAYBOUND, .Variant.VARIANT, .Variant.VariantArg, .WTypes.BSTR, .WTypes.VARTYPE, .WTypes.VARTYPEByReference, .WinBase.SYSTEMTIME, .WinDef.LCID, .WinDef.LONG, .WinDef.PVOID, .WinDef.UINT, .WinNT.HRESULT, com.sun.jna.ptr.DoubleByReference, .PointerByReference, com.sun.jna.win32.StdCallLibrary, .W32APIOptions

Oleaut32.dll Interface.
Author
scott.palmer

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
OleAuto.DISPPARAMS

The Class DISPPARAMS.

Field Summary

Modifier and TypeField and Description
public static final int
DISPATCH_METHOD

The Constant DISPATCH_METHOD.

public static final int
DISPATCH_PROPERTYGET

The Constant DISPATCH_PROPERTYGET.

public static final int
DISPATCH_PROPERTYPUT

The Constant DISPATCH_PROPERTYPUT.

public static final int
DISPATCH_PROPERTYPUTREF

The Constant DISPATCH_PROPERTYPUTREF.

public static final int
FADF_AUTO

An array that is allocated on the stac.

public static final int
FADF_BSTR

An array of BSTRs.

public static final int
FADF_DISPATCH

An array of IDispatch*.

public static final int
FADF_EMBEDDED

An array that is embedded in a structure.

public static final int
FADF_FIXEDSIZE

An array that is embedded in a structure.

public static final int
FADF_HAVEIID

An array that is embedded in a structure.

public static final int
FADF_HAVEVARTYPE

An array that has a variant type.

public static final int
FADF_RECORD

An array that is embedded in a structure.

public static final int
FADF_RESERVED

Bits reserved for future use.

public static final int
FADF_STATIC

An array that is statically allocated.

public static final int
FADF_UNKNOWN

An array of IUnknown*.

public static final int
FADF_VARIANT

An array of VARIANTs.

public static final OleAuto
INSTANCE

The instance.

public static final short
VARIANT_ALPHABOOL

For VT_BOOL to VT_BSTR conversions, convert to "True"/"False" instead of "-1"/"0"

public static final short
VARIANT_CALENDAR_GREGORIAN

SOUTHASIA calendar support

public static final short
public static final short
VARIANT_CALENDAR_THAI

SOUTHASIA calendar support

public static final short
VARIANT_LOCALBOOL

For VT_BOOL to VT_BSTR and back, convert to local language rather than English

public static final short
VARIANT_NOUSEROVERRIDE

For conversions to/from VT_BSTR, passes LOCALE_NOUSEROVERRIDE to core coercion routines

public static final short
public static final short
VARIANT_USE_NLS

NLS function call support

Inherited from com.sun.jna.win32.StdCallLibrary:
FUNCTION_MAPPERSTDCALL_CONVENTION

Method Summary

Modifier and TypeMethod and Description
public WinNT.HRESULT

Returns:

Return value If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
GetActiveObject
(Guid.GUID
[in] The class identifier (CLSID) of the active object from the OLE registration database.
rclsid
,
WinDef.PVOID
Reserved for future use. Must be null.
pvReserved
,
PointerByReference
[out] The requested active object.
ppunk
)

Retrieves a pointer to a running object that has been registered with OLE.

public WinNT.HRESULT

Returns:

status
LoadRegTypeLib
(Guid.GUID
The GUID of the library.
rguid
,
int
The major version of the library.
wVerMajor
,
int
The minor version of the library.
wVerMinor
,
WinDef.LCID
The national language code of the library.
lcid
,
PointerByReference
The loaded type library. This function can return one of these values: S_OK Success. E_INVALIDARG One or more of the arguments is not valid. E_OUTOFMEMORY Insufficient memory to complete the operation. TYPE_E_IOERROR The function could not write to the file. TYPE_E_INVALIDSTATE The type library could not be opened. TYPE_E_INVDATAREAD The function could not read from the file. TYPE_E_UNSUPFORMAT The type library has an older format. TYPE_E_UNKNOWNLCID The LCID could not be found in the OLE-supported DLLs. TYPE_E_CANTLOADLIBRARY The type library or DLL could not be loaded.
pptlib
)

Uses registry information to load a type library.

public WinNT.HRESULT

Returns:

status
LoadTypeLib
(String
The name of the file from which the method should attempt to load a type library.
szFile
,
PointerByReference
The loaded type library. Return value This function can return one of these values. S_OK Success. E_INVALIDARG One or more of the arguments is not valid. E_OUTOFMEMORY Insufficient memory to complete the operation. TYPE_E_IOERROR The function could not write to the file. TYPE_E_INVALIDSTATE The type library could not be opened. TYPE_E_INVDATAREAD The function could not read from the file. TYPE_E_UNSUPFORMAT The type library has an older format. TYPE_E_UNKNOWNLCID The LCID could not be found in the OLE-supported DLLs. TYPE_E_CANTLOADLIBRARY The type library or DLL could not be loaded.
pptlib
)

Loads and registers a type library.

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
E_UNEXPECTED
The array could not be locked.
SafeArrayAccessData
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
,
PointerByReference
[in] pointer to the data array
ppvData
)

Lock array and retrieve pointer to data

public OaIdl.SAFEARRAY.ByReference

Returns:

Return value A safe array descriptor, or null if the array could not be created.
SafeArrayCreate
(WTypes.VARTYPE
[in] The base type of the array (the VARTYPE of each element of the array). The VARTYPE is restricted to a subset of the variant types. Neither the VT_ARRAY nor the VT_BYREF flag can be set. VT_EMPTY and VT_NULL are not valid base types for the array. All other types are legal. cDims
vt
,
WinDef.UINT
the number of dims
cDims
,
OaIdl.SAFEARRAYBOUND[]
the rgsabound
rgsabound
)

Creates a new array descriptor, allocates and initializes the data for the array, and returns a pointer to the new array descriptor.

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
DISP_E_ARRAYISLOCKED
The array could not be locked.
SafeArrayDestroy
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
)

Destroys an existing array descriptor and all of the data in the array.

public WinDef.UINT

Returns:

Return count of dimensions
SafeArrayGetDim
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
)

Return number of dimensions of the SAFEARRAY

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
DISP_E_BADINDEX
The specified index is not valid.
E_INVALIDARG
One of the arguments is not valid.
E_OUTOFMEMORY
Memory could not be allocated for the element.
SafeArrayGetElement
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
,
WinDef.LONG[]
[in] A vector of indexes for each dimension of the array. The right-most (least significant) dimension is rgIndices[0]. The left-most dimension is stored at rgIndices[psa->cDims - 1].
rgIndices
,
Pointer
[out] The element of the array.
pv
)

Retrieves a single element of the array.

public WinDef.UINT

Returns:

size in bytes
SafeArrayGetElemsize
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
)

Get size of one element in bytes

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
DISP_E_BADINDEX
The specified index is not valid.
E_INVALIDARG
One of the arguments is not valid.
SafeArrayGetLBound
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
,
WinDef.UINT
[in] the dimension, one based
nDim
,
WinDef.LONGByReference
[out] lower bound for the supplied dimension
bound
)

Retrieve the lower bound for the specified dimension of the supplied array

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
DISP_E_BADINDEX
The specified index is not valid.
E_INVALIDARG
One of the arguments is not valid.
SafeArrayGetUBound
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
,
WinDef.UINT
[in] the dimension, one based
nDim
,
WinDef.LONGByReference
[out] upper bound for the supplied dimension
bound
)

Retrieve the upper bound for the specified dimension of the supplied array

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
SafeArrayGetVartype
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
,
WTypes.VARTYPEByReference
[in] Vartype of the SAFEARRAY
pvt
)

Return VARTYPE of the SAFEARRAY

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
E_UNEXPECTED
The array could not be locked.
SafeArrayLock
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
)

Increments the lock count of an array, and places a pointer to the array data in pvData of the array descriptor.

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
DISP_E_BADINDEX
The specified index is not valid.
E_INVALIDARG
One of the arguments is not valid.
SafeArrayPtrOfIndex
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
,
WinDef.LONG[]
[in] A vector of indexes for each dimension of the array. The right-most (least significant) dimension is rgIndices[0]. The left-most dimension is stored at rgIndices[psa->cDims - 1].
rgIndices
,
PointerByReference
[out] The element of the array.
ppv
)

Retrieves the pointer to a single element of the array.

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
DISP_E_BADINDEX
The specified index is not valid.
E_INVALIDARG
One of the arguments is not valid.
E_OUTOFMEMORY
Memory could not be allocated for the element.
SafeArrayPutElement
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
,
WinDef.LONG[]
the idx
idx
,
Pointer
[in] The data to assign to the array. The variant types VT_DISPATCH, VT_UNKNOWN, and VT_BSTR are pointers, and do not require another level of indirection.
pv
)

Stores the data element at the specified location in the array.

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
DISP_E_ARRAYISLOCKED
The array could not be locked.
SafeArrayRedim
(OaIdl.SAFEARRAY
[in, out] An array descriptor created by SafeArrayCreate.
psa
,
OaIdl.SAFEARRAYBOUND
[in] New bounds for the least significant dimension
psaboundNew
)

Changes the right-most (least significant) bound of the specified safe array.

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
E_UNEXPECTED
The array could not be locked.
SafeArrayUnaccessData
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
)

Unlock array and invalidate the pointer retrieved via SafeArrayAccessData

public WinNT.HRESULT

Returns:

Return value This function can return one of these values.
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
E_UNEXPECTED
The array could not be locked.
SafeArrayUnlock
(OaIdl.SAFEARRAY
[in] An array descriptor created by SafeArrayCreate.
psa
)

Decrements the lock count of an array so it can be freed or resized.

public WTypes.BSTR

Returns:

Null if there is insufficient memory or if a null pointer is passed in.
SysAllocString
(String
Null-terminated UNICODE string to copy.
sz
)

This function allocates a new string and copies the passed string into it.

public void
SysFreeString(WTypes.BSTR
Unicode string that was allocated previously, or NULL. Setting this parameter to NULL causes the function to simply return.
bstr
)

This function frees a string allocated previously by SysAllocString, SysAllocStringByteLen, SysReAllocString, SysAllocStringLen, or SysReAllocStringLen.

public int
SysStringByteLen(WTypes.BSTR
Unicode string that was allocated previously.
bstr
)

Returns the length (in bytes) of a BSTR.

public int
SysStringLen(WTypes.BSTR
Unicode string that was allocated previously.
bstr
)

Returns the length of a BSTR.

public int

Returns:

The function returns TRUE on success and FALSE otherwise.
SystemTimeToVariantTime
(WinBase.SYSTEMTIME
[in] The system time.
lpSystemTime
,
DoubleByReference
[out] The variant time.
pvtime
)

Converts a system time to a variant representation.

public WinNT.HRESULT

Returns:

This function can return one of these values:
Return codeDescription
S_OKSuccess.
DISP_E_BADVARTYPEThe variant type is not a valid type of variant.
DISP_E_OVERFLOWThe data pointed to by pvarSrc does not fit in the destination type.
DISP_E_TYPEMISMATCHThe argument could not be coerced to the specified type.
E_INVALIDARGOne of the arguments is not valid.
E_OUTOFMEMORYInsufficient memory to complete the operation.

Remarks

The VariantChangeType function handles coercions between the fundamental types (including numeric-to-string and string-to-numeric coercions). The pvarSrc argument is changed during the conversion process. For example, if the source variant is of type VT_BOOL and the destination is of type VT_UINT, the pvarSrc argument is first converted to VT_I2 and then the conversion proceeds. A variant that has VT_BYREF set is coerced to a value by obtaining the referenced value. An object is coerced to a value by invoking the object's Value property (DISPID_VALUE).

Typically, the implementor of IDispatch.Invoke determines which member is being accessed, and then calls VariantChangeType to get the value of one or more arguments. For example, if the IDispatch call specifies a SetTitle member that takes one string argument, the implementor would call VariantChangeType to attempt to coerce the argument to VT_BSTR. If VariantChangeType does not return an error, the argument could then be obtained directly from the bstrVal field of the VARIANT. If VariantChangeType returns DISP_E_TYPEMISMATCH, the implementor would set Invoke puArgErr parameter referenced value to 0 (indicating the argument in error) and return DISP_E_TYPEMISMATCH from Invoke.

Arrays of one type cannot be converted to arrays of another type with this function.

Note The type of a VARIANT should not be changed in the rgvarg array in place.
VariantChangeType
(Variant.VARIANT
[out] The destination variant. If this is the same as pvarSrc, the variant will be converted in place.
pvargDest
,
Variant.VARIANT
[in] The variant to convert.
pvarSrc
,
short
Combination of the following flags
wFlags
ValueMeaning
VARIANT_NOVALUEPROPPrevents the function from attempting to coerce an object to a fundamental type by getting the Value property. Applications should set this flag only if necessary, because it makes their behavior inconsistent with other applications.
VARIANT_ALPHABOOLConverts a VT_BOOL value to a string containing either "True" or "False".
VARIANT_NOUSEROVERRIDEFor conversions to or from VT_BSTR, passes LOCALE_NOUSEROVERRIDE to the core coercion routines.
VARIANT_LOCALBOOLFor conversions from VT_BOOL to VT_BSTR and back, uses the language specified by the locale in use on the local computer.
wFlags
,
WTypes.VARTYPE
The type to convert to. If the return code is S_OK, the vt field of the vargDest is guaranteed to be equal to this value.
vt
)

Converts a variant from one type to another.

public WinNT.HRESULT

Returns:

This function can return one of these values:
Return codeDescription
S_OKSuccess.
DISP_E_BADVARTYPEThe variant type is not a valid type of variant.
DISP_E_OVERFLOWThe data pointed to by pvarSrc does not fit in the destination type.
DISP_E_TYPEMISMATCHThe argument could not be coerced to the specified type.
E_INVALIDARGOne of the arguments is not valid.
E_OUTOFMEMORYInsufficient memory to complete the operation.

Remarks

The VariantChangeType function handles coercions between the fundamental types (including numeric-to-string and string-to-numeric coercions). The pvarSrc argument is changed during the conversion process. For example, if the source variant is of type VT_BOOL and the destination is of type VT_UINT, the pvarSrc argument is first converted to VT_I2 and then the conversion proceeds. A variant that has VT_BYREF set is coerced to a value by obtaining the referenced value. An object is coerced to a value by invoking the object's Value property (DISPID_VALUE).

Typically, the implementor of IDispatch.Invoke determines which member is being accessed, and then calls VariantChangeType to get the value of one or more arguments. For example, if the IDispatch call specifies a SetTitle member that takes one string argument, the implementor would call VariantChangeType to attempt to coerce the argument to VT_BSTR. If VariantChangeType does not return an error, the argument could then be obtained directly from the bstrVal field of the VARIANT. If VariantChangeType returns DISP_E_TYPEMISMATCH, the implementor would set Invoke puArgErr parameter referenced value to 0 (indicating the argument in error) and return DISP_E_TYPEMISMATCH from Invoke.

Arrays of one type cannot be converted to arrays of another type with this function.

Note The type of a VARIANT should not be changed in the rgvarg array in place.
VariantChangeType
(Variant.VARIANT.ByReference
[out] The destination variant. If this is the same as pvarSrc, the variant will be converted in place.
pvargDest
,
Variant.VARIANT.ByReference
[in] The variant to convert.
pvarSrc
,
short
Combination of the following flags
wFlags
ValueMeaning
VARIANT_NOVALUEPROPPrevents the function from attempting to coerce an object to a fundamental type by getting the Value property. Applications should set this flag only if necessary, because it makes their behavior inconsistent with other applications.
VARIANT_ALPHABOOLConverts a VT_BOOL value to a string containing either "True" or "False".
VARIANT_NOUSEROVERRIDEFor conversions to or from VT_BSTR, passes LOCALE_NOUSEROVERRIDE to the core coercion routines.
VARIANT_LOCALBOOLFor conversions from VT_BOOL to VT_BSTR and back, uses the language specified by the locale in use on the local computer.
wFlags
,
WTypes.VARTYPE
The type to convert to. If the return code is S_OK, the vt field of the vargDest is guaranteed to be equal to this value.
vt
)

Converts a variant from one type to another.

public WinNT.HRESULT

Returns:

the hresult
VariantClear
(Variant.VARIANT
[in, out] The variant to clear.
pvarg
)

Use this function to clear variables of type VARIANTARG (or VARIANT) before the memory containing the VARIANTARG is freed (as when a local variable goes out of scope).

public WinNT.HRESULT

Returns:

the hresult
VariantCopy
(Pointer
[out] The destination variant.
pvargDest
,
Variant.VARIANT
[in] The source variant.
pvargSrc
)

First, free any memory that is owned by pvargDest, such as VariantClear (pvargDest must point to a valid initialized variant, and not simply to an uninitialized memory location).

public void
VariantInit(Variant.VARIANT.ByReference
The variant to initialize.
pvarg
)

The VariantInit function initializes the VARIANTARG by setting the vt field to VT_EMPTY.

public void
VariantInit(Variant.VARIANT
The variant to initialize.
pvarg
)

The VariantInit function initializes the VARIANTARG by setting the vt field to VT_EMPTY.

public int

Returns:

The function returns TRUE on success and FALSE otherwise.
VariantTimeToSystemTime
(double
[in] The variant time.
vtime
,
WinBase.SYSTEMTIME
[out] The system time.
lpSystemTime
)

Converts a variant representation of time to a system time.