contents   index   previous   next



VariantInit

 

f90VB Modules

 

f90VBDefs, f90VBVariants

Summary

 

Initializes a variant to VT_EMPTY

Syntax

 

subroutine VariantInit (VarDest, iRet)

type(VARIANT),intent(inout)::  VarDest
integer(HRESULT_KIND),intent(out),optional:: iRet

Arguments

 

VarDest [Input/Output]

Variant to be initialized

iRet [Output/Optional]

Upon return, iRet contains S_OK or an error code. See comments for more information.

Comments

 

VariantInit sets the vt field of a variant to VT_EMPTY. All the other fields of the variant are set to zero. Use VariantInit only to initialize local variants that have not been already assigned a content.

 

Note that VariantInit does not interpret the current content of the variant, if any. So calling this subroutine on variants containing dynamically allocated types (e.g. BStrings, Safe Arrays, etc.) may result in memory leaks unless you have another way to retrieve the handle to the contents in the variant being initialized.

 

To re-initialize a variant that already contains data, use subroutine VariantClear.

 

You can also initialize a variant to VT_EMPTY by assigning to it the result of function VariantCreate (Syntax Variation 1).

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.
Any negative value Failure

Related Topics

 

For information about: See:
Clearing the contents of variants VariantClear
Creating new variants VariantCreate
Copying a Variant VariantCopy

 


VariantInt