VARIANT Structure
Most of the Active Accessibility functions and the IAccessible properties and methods take a VARIANT structure as a parameter. Essentially, the VARIANT structure is a container for a large union that carries many types of data.
The value in the first member of the structure, vt, describes which of the union members is valid. Although the VARIANT structure supports many different data types, Active Accessibility uses only the following types.
vt Value | Corresponding value member name |
---|---|
VT_I4 | lVal |
VT_DISPATCH | pdispVal |
VT_BSTR | bstrVal |
VT_EMPTY | none |
When you receive information in a VARIANT structure, check the vt member to find out which member contains valid data. Similarly, when you send information using a VARIANT structure, always set vt to reflect the union member that contains the information.
Before using the structure, initialize it by calling the VariantInit COM function. When finished with the structure, clear it before the memory that contains the VARIANT is freed by calling VariantClear.
For more information about the VARIANT structure, see DeleteDC.