VariantBStrFrom<VarType>
f90VB Modules
f90VBDefs, f90VBVariants
Summary
Set of low-level subroutines to convert variant data types to an unsigned 4-byte integer.
Syntax
| subroutine VariantBStrFromUI1 | (VarSrc, VarDest, iRet) |
| integer(BYTE_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromI1 | (VarSrc, VarDest, iRet) |
| integer(BYTE_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromI2 | (VarSrc, VarDest, iRet) |
| integer(SHORT_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromUI2 | (VarSrc, VarDest, iRet) |
| integer(SHORT_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromI4 | (VarSrc, VarDest, iRet) |
| integer(LONG_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromR4 | (VarSrc, VarDest, iRet) |
| real(FLOAT_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromR8 | (VarSrc, VarDest, iRet) |
| real(DOUBLE_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromCy | (VarSrc, VarDest, iRet) |
| type(CURRENCY),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromDec | (VarSrc, VarDest, iRet) |
| type(DECIMAL),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromDate | (VarSrc, VarDest, iRet) |
| real(DATE_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromBool | (VarSrc, VarDest, iRet) |
| integer(VAR_BOOLEAN_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromUI4 | (VarSrc, lcid, dwflags, VarDest, iRet) |
| integer(LONG_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),intent(out):: | VarDest |
| integer(HRESULT_KIND),intent(out):: | iRet |
| subroutine VariantBStrFromDisp | (VarSrc, lcid, VarDest, iRet) |
| integer(POINTER_KIND),intent(in):: | VarSrc |
| integer(LCID_KIND),intent(in):: | lcid |
| integer(DWORD_KIND),intent(in):: | dwflags |
| integer(BSTRHNDL_KIND),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. See comments below for valid flag values.
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. | |
Argument dwflags
The following constants define the valid flags that can be used with these subroutines:
| Flag Identifier | Description | |
| LOCALE_NOUSEROVERRIDE | Uses the system default locale settings, rather than custom locale settings. | |
| VAR_TIMEVALUEONLY | Omits the date portion of a VT_DATE and returns only the time. Applies to conversions from dates. | |
| VAR_DATEVALUEONLY | Omits the time portion of a VT_DATE and returns only the date. Applies to conversions from dates. | |
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 | |