proper way of handling [out,retval] VARIANT * args
- From: "Jason S" <jmsachs@xxxxxxxxx>
- Date: 23 Aug 2006 09:19:54 -0700
Oh wise masters of COM:
what's the proper way to handle an [out,retval] VARIANT *arg ?
Do you use VariantInit() after checking for a null arg, or
VariantClear?
STDMETHODIMP CBlah::get_something(VARIANT *pVal)
{
if (pVal == NULL)
return E_POINTER;
VariantInit(pVal);
// do some stuff, it may return an error
// everything is great, assign the VARIANT
CComBSTR b = L"something from blah";
V_VT(pVal) = VT_BSTR;
V_BSTR(pVal) = b.Detach();
return S_OK;
}
.
- Follow-Ups:
- Re: proper way of handling [out,retval] VARIANT * args
- From: Alexander Nickolov
- Re: proper way of handling [out,retval] VARIANT * args
- Prev by Date: Re: Interface-based security?
- Next by Date: Re: Creating some classes derived from IDispatch
- Previous by thread: Interface-based security?
- Next by thread: Re: proper way of handling [out,retval] VARIANT * args
- Index(es):
Relevant Pages
|