111,128
社区成员
发帖
与我相关
我的任务
分享HRESULT CBrowserHost::GetOptionKeyPath(LPOLESTR *pchKey, DWORD dwReserved)
{
HRESULT hr;
WCHAR* szKey = L"Software\\MyCompany\\MyApp";
// cbLength is the length of szKey in bytes.
size_t cbLength;
hr = StringCbLengthW(szKey, 1280, &cbLength);
// TODO: Add error handling code here.
if (pchKey)
{
*pchKey = (LPOLESTR)CoTaskMemAlloc(cbLength + sizeof(WCHAR));
if (*pchKey)
hr = StringCbCopyW(*pchKey, cbLength + sizeof(WCHAR), szKey);
}
else
hr = E_INVALIDARG;
return hr;
}