Share via


CComVariant Class

This class wraps the VARIANT type, providing a member indicating the type of data stored.

class CComVariant : public tagVARIANT

Members

Public Constructors

Name

Description

CComVariant::CComVariant

The constructor.

CComVariant::~CComVariant

The destructor.

Public Methods

Name

Description

CComVariant::Attach

Attaches a VARIANT to the CComVariant object.

CComVariant::ChangeType

Converts the CComVariant object to a new type.

CComVariant::Clear

Clears the CComVariant object.

CComVariant::Copy

Copies a VARIANT to the CComVariant object.

CComVariant::CopyTo

Copies the contents of the CComVariant object.

CComVariant::Detach

Detaches the underlying VARIANT from the CComVariant object.

CComVariant::GetSize

Returns the size in number of bytes of the contents of the CComVariant object.

CComVariant::ReadFromStream

Loads a VARIANT from a stream.

CComVariant::SetByRef

Initializes the CComVariant object and sets the vt member to VT_BYREF.

CComVariant::WriteToStream

Saves the underlying VARIANT to a stream.

Public Operators

CComVariant::operator <

Indicates whether the CComVariant object is less than the specified VARIANT.

CComVariant::operator >

Indicates whether the CComVariant object is greater than the specified VARIANT.

operator !=

Indicates whether the CComVariant object does not equal the specified VARIANT.

operator =

Assigns a value to the CComVariant object.

operator ==

Indicates whether the CComVariant object equals the specified VARIANT.

Remarks

CComVariant wraps the VARIANT and VARIANTARG type, which consists of a union and a member indicating the type of the data stored in the union. VARIANTs are typically used in Automation.

CComVariant derives from the VARIANT type so it can be used wherever a VARIANT can be used. You can, for example, use the V_VT macro to extract the type of a CComVariant or you can access the vt member directly just as you can with a VARIANT.

Inheritance Hierarchy

tagVARIANT

CComVariant

Requirements

Header: atlcomcli.h

See Also

Other Resources

ATL Class Overview