VariantDecFrom<VarType>
f90VB Modules
f90VBDefs, f90VBVariants
Summary
Set of low-level subroutines to convert variant data types to a decimal type.
Syntax
| subroutine VariantDecFromUI1 | (VarSrc, VarDest, iRet) |
| integer(BYTE_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | IRet |
| subroutine VariantDecFromI1 | (VarSrc, VarDest, iRet) |
| integer(BYTE_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromI2 | (VarSrc, VarDest, iRet) |
| integer(SHORT_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromUI2 | (VarSrc, VarDest, iRet) |
| integer(SHORT_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| Subroutine VariantDecFromUI4 | (VarSrc, VarDest, iRet) |
| integer(LONG_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| Subroutine VariantDecFromI4 | (VarSrc, VarDest, iRet) |
| integer(LONG_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| Subroutine VariantDecFromR4 | (VarSrc, VarDest, iRet) |
| real(FLOAT_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromDate | (VarSrc, VarDest, iRet) |
| real(DATE_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromCy | (VarSrc, VarDest, iRet) |
| type(CURRENCY),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromR8 | (VarSrc, VarDest, iRet) |
| real(DOUBLE_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromBool | (VarSrc, VarDest, iRet) |
| integer(VAR_BOOLEAN_KIND),intent(in):: | VarSrc |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromStr | (VarSrc, lcid, dwflags, VarDest, iRet) |
| integer(BSTRHNDL_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantDecFromDisp | (VarSrc, lcid, VarDest, iRet) |
| integer(POINTER_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| type(DECIMAL),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
Arguments
VarSrc [Input]
Value to coerce.
VarDest [Output]
Coerced value.
iRet [Output]
Upon return, iRet contains S_OK or an error code. See comments for more information.
lcid [Input]
A locale identifier.
dwflags [Input]
Flags that control the coercion of VarSrc. The only defined flag is LOCALE_NOUSEROVERRIDE, which forces the use of the system default locale settings, rather than custom locale settings.
Comments
These functions are direct wrappers to low-level functions provided by Windows’ OLE API. Rather than coding your own conversion functions, you should use these subroutines to ensure OLE-compliant conversion of variant types.
Argument iRet
Indicates success or failure of the subroutine. The following codes can be returned in this argument:
| Value returned in argument iRet | Description | |
| S_OK | Success. | |
| DISP_E_BADVARTYPE | One or both of the passed variant types are not a valid type of variant. | |
| DISP_E_TYPEMISMATCH | At least one of the variants could not be coerced to the appropriate type for this operation. | |
| E_INVALIDARG | One of the arguments is invalid. | |
| E_OUTOFMEMORY | Memory could not be allocated for the operation.. | |
| DISP_E_OVERFLOW | The data pointed to by VarSrc does not fit in the destination type. | |
Related Topics
| For information about: | See: | |
| Changing the type of a variant | VariantChangeType | |
| Initializing a variant | VariantInit | |
| Copying a Variant | VariantCopy, VariantCopyInd | |
| Creating new variants | VariantCreate | |