VARIANT_true 16位值-1, VARIANT_false 16位 0
C++ 中的bool 8位的1,0
CComVariant 的一些方法
Attach
Attaches a VARIANT to the CComVariant object.
将资源从VARIANT结构的资源所有权从结构交给CComVariant 实例. 它清除当前实例,执行memocpy把variant结构复制到当前实例中
CComVariant
The constructor.
~CComVariant
The destructor.
ChangeType
Converts the CComVariant object to a new type.
Clear
Clears the CComVariant object.
Copy
Copies a VARIANT to the CComVariant object.
复制一个作为in 参数的variant
CopyTo
Copies the contents of the CComVariant object.
Detach
Detaches the underlying VARIANT from the CComVariant object.
将CComVariant 实例中的资源的所有权转移到一个variant结构中, 在把CComVariant 实例中资源中资 源分离detach到一个out variant参数之前,一定要保证输出参数已经被实例化
STDMETHODIMP CFun::get_Option(VARIANT* oPtion)
{
::VariantInit(oPtion);
return varOption.Detach(oPtion);
}
GetSize
Returns the size in number of bytes of the contents of the CComVariant object.
ReadFromStream
Loads a VARIANT from a stream.
SetByRef
Initializes the CComVariant object and sets the vt member to VT_BYREF.
WriteToStream
Saves the underlying VARIANT to a stream.