If I am using OleVariant
instead of VARIANTARG
to store VT_BSTR
(VOleStr
in OleVariant
), do I still need to call SafeSysFreeString
when I am done with the string, or is it called automatically by OleVariant, when it goes out of scope?
For example:
{
WB->Navigate("https://www.example.com");
while (WB->ReadyState != Shdocvw::READYSTATE_COMPLETE) Application->ProcessMessages();
DelphiInterface<IOleCommandTarget> pOleCmdTarget;
WB->Document->QueryInterface(IID_IOleCommandTarget, (void**)&pOleCmdTarget);
OleVariant v;
if (pOleCmdTarget->Exec(&CMDSETID_Forms3, IDM_FONTNAME, Shdocvw::MSOCMDEXECOPT_DONTPROMPTUSER, NULL, v)==S_OK)
{
// utilize v.VOleStr here...
}
} // Does OleVariant auto-deallocate (SafeSysFreeString) here?
OleVariant
will automatically free its data's memory for you when it goes out of scope.