VariantClear和VariantInit的区别

  • VariantClear:释放当前的变量内容后,置类型为VT_EMPTY

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).

The function clears a VARIANTARG by setting the vt member to VT_EMPTY and the wReserved member to 0. The current contents of the VARIANTARG are released first.

If the vt member is VT_BSTR, the string is freed.

If the vt member is VT_DISPATCH, the object is released.

If the vt member has the VT_ARRAY bit set, the array is freed.

  • VariantInit:仅变量类型为VT_EMPTY

Passing invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.

The VariantInit function initializes the VARIANTARG by setting the vt member to VT_EMPTY.

Unlike VariantClear, this functiondoes not interpret the current contents of the VARIANTARG.

Use VariantInit to initialize new local variables of type VARIANTARG (or VARIANT).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值