VariantChangeType

来源:互联网 发布:防范电信网络诈骗视频 编辑:程序博客网 时间:2024/06/03 21:24

Yes you must call VariantClear. The VariantChangeType method if successful will essentially coerce a copy of the source into the destination. This copy in the destination is now independently tracked and must be independently cleared.


   VARIANT varDest;
    varDest.vt = VT_EMPTY;
    if(SUCCEEDED(::VariantChangeType(&varDest, 
        const_cast<VARIANT *>(&val), 0, VT_BSTR)))
    {
        //Do I need to call the following?
        VariantClear(&varDest);
    }


    VariantClear(&val);

原创粉丝点击