Jezik
Bilješka
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati da se prijavite ili promijenite direktorije.
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati promijeniti direktorije.
Returns the number of characters in the associated property's string.
Syntax
Parameters
| Parameter | Description |
|---|---|
pLen |
[out] Returns the number of characters in the property's string. |
Return Value
If successful, returns S_OK; otherwise returns error code.
Remarks
Typically, this method is used as a prelude to allocating a buffer for a call to the GetStringChars method.
Example
The following example shows how to implement this method for a CProperty object that exposes the IDebugProperty3 interface.
STDMETHODIMP CProperty::GetStringCharLength(ULONG *pLen)
{
HRESULT hr = E_INVALIDARG;
EVALFLAGS oldEVALFLAGS = m_EVALFLAGS;
m_EVALFLAGS &= ~EVAL_NOFUNCEVAL;
if (pLen)
{
DEBUG_PROPERTY_INFO dpInfo;
dpInfo.bstrValue = NULL;
ULONG ulen = 0;
hr = GetPropertyInfo(DEBUGPROP_INFO_VALUE,10,DEFAULT_TIMEOUT,NULL,0,&dpInfo);
if (hr == S_OK && dpInfo.bstrValue)
{
if (wcscmp(dpInfo.bstrValue,L"Nothing") == 0)
{
ulen = 0; //VSWhidbey#64815
}
else
{
ulen = ::SysStringLen(dpInfo.bstrValue);
if( ulen > 2 &&
dpInfo.bstrValue[0] == L'"' &&
dpInfo.bstrValue[ulen-1] == L'"')
{
ulen = ulen > 2 ? ulen - 2 : ulen; //remove two double quotes
}
}
}
::SysFreeString(dpInfo.bstrValue);
*pLen = ulen;
}
m_EVALFLAGS = oldEVALFLAGS;
return hr;
}