OleVariant 和 SafeSysFreeString
OleVariant and SafeSysFreeString
如果我使用 OleVariant
而不是 VARIANTARG
来存储 VT_BSTR
(VOleStr
in OleVariant
),我还需要调用 SafeSysFreeString
当我处理完字符串时,还是当它超出范围时由 OleVariant 自动调用?
例如:
{
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
将在超出范围时自动为您释放其数据内存。
如果我使用 OleVariant
而不是 VARIANTARG
来存储 VT_BSTR
(VOleStr
in OleVariant
),我还需要调用 SafeSysFreeString
当我处理完字符串时,还是当它超出范围时由 OleVariant 自动调用?
例如:
{
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
将在超出范围时自动为您释放其数据内存。