未分类--Windows API--VariantClear

150 篇文章 0 订阅
31 篇文章 0 订阅

原文来自MSDN Library for Visual Studio 2008 SP1,翻译部分仅为个人观点,想要看更多信息请看MSDN,如有版权问题请联系QQ 643166601,邮件643166601@qq.com

 

Platform Builder for Microsoft Windows CE 5.0   

VariantClear
This function clears a variant.
这个函数清除一个variant。
HRESULT VariantClear(
  VARIANTARG FAR* pvarg
);
Parameters
pvarg
[in, out] Pointer to the VARIANTARG to clear.
指针指向的VARIANTARG将清除。
Return Values
Returns the HRESULT values shown in the following table.
返回的HRESULT展示在下表。
Value Description
S_OK
Success.
成功。
DISP_E_ARRAYISLOCKED
The variant contains an array that is locked.
这个variant包的数组被锁定。
DISP_E_BADVARTYPE
The variant type pvarg is not a valid type of variant.
这个variant类型的pvarg不是有效的variant的类型。
E_INVALIDARG
An argument is invalid. 
一个说法是无效的。
Remarks
Use this function to clear variables of type VARIANTARG (or VARIANT) before the memory that contains the VARIANTARG is freed (as when a local variable goes out of scope).
使用这个函数去清除VARIANTARG (或 VARIANT)类型的变量在内存包含的VARIANTARG被释放(当一个局部变量超出作用域时)。
The function clears a VARIANTARG by setting the vt member to VT_EMPTY and the wReserved member to 0.
这个函数通过设置vt成员为VT_EMPTY和wReserved成员为0来清除。
The current contents of the VARIANTARG are released first.
这个VARIANTARG当前内容首先被释放。
If the vt member is VT_BSTR, the string is freed.
如果vt成员是VT_BSTR,这个字符串被释放。
If the vt member is VT_DISPATCH, the object is released.
如果vt成员是VT_DISPATCH,这个对象将被释放。
If the vt member has the VT_ARRAY bit set, the array is freed.
如果vt成员是VT_ARRAY位设置,这个数组被释放。
In certain cases, it might be preferable to clear a variant in code without calling VariantClear.
在某些情况下,它可能是更好的在代码中去清除一个variant不调用VariantClear。
For example, you can change the type of a VT_I4 variant to another type without calling this function.
例如,你可以改变VT_I4 variant类型到另一种类型,不调用这个函数。
However, you must call VariantClear if a VT_* type is received but cannot be handled.
然而,如果返回一个VT_*类型你必须调用VariantClear但是不能被处理。
Using VariantClear in these cases ensures that code will continue to work if Automation adds variant types in the future.
使用VariantClear在这些情况中确保如果在将来自动增长的variant中代码将继续工作。
Passing invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.
传入无效的(在某些情况下NULL)指针到这个函数引起意外的程序终止。
In this context, an invalid pointer is one that points to an invalid region in memory, is NULL, contains an unaligned pointer, points to memory block smaller than necessary, and so on.
在这个上下文,一个无效的指针是一个指向无效内存中的区域,是NULL,包含一个不对齐的指针,指向的内存块比必须的还小,等等。
Requirements
OS Versions: Windows CE 2.0 and later.
Header: Oleauto.h.
Link Library: Oleaut32.lib.

See Also
Automation Functions | VARIANTARG

 


--------------------------------------------------------------------------------

Last updated on Wednesday, September 14, 2005

© 2005 Microsoft Corporation. All rights reserved.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值