VARIANT as [out] parameters
-
Hi all, When outputting a VARIANT from a COM interface member (as an [out] parameter, not [in, out]), should I call ::VariantClear() or ::VariantInit() on the output parameter before assigning to it? Or is this redundant/incorrect? e.g.: STDMETHODIMP MyFunc (/*[out]*/ VARIANT* pVal) { VariantInit (pVal); // ok? pVal->vt = .... ... } cheers NB
-
Hi all, When outputting a VARIANT from a COM interface member (as an [out] parameter, not [in, out]), should I call ::VariantClear() or ::VariantInit() on the output parameter before assigning to it? Or is this redundant/incorrect? e.g.: STDMETHODIMP MyFunc (/*[out]*/ VARIANT* pVal) { VariantInit (pVal); // ok? pVal->vt = .... ... } cheers NB
See sample app of COM Variant and Safearrays at http://www.sellsbrothers.com/tools/CComSafeArray.zip (from chris sells site)