CGXAbstractUserAttribute::GetValue
virtual const CString& GetValue() const;
Return Value
The textual representation of the binary value stored in this object.
Remarks
GetValue returns a CString with the textual representation of the binary stored in the user attribute. Override this method if you want to support writing values to registry or the user attribute page.
Example:
const CString& CGXUserAttribute::GetValue() const
{
switch (m_vtType)
{
case vtEmpty:
m_strValueCache.Empty();
return m_strValueCache;
case vtDWord:
m_strValueCache.Format(_T("%lu"), m_value.dwValue);
return m_strValueCache;
case vtLong:
m_strValueCache.Format(_T("%ld"), m_value.lValue);
return m_strValueCache;
case vtShortString:
{
LPTSTR p = m_strValueCache.GetBuffer(8/sizeof(TCHAR)+1);
_tcsncpy(p, m_value.szShortString, 8/sizeof(TCHAR));
p[8/sizeof(TCHAR)] = 0;
m_strValueCache.ReleaseBuffer();
}
return m_strValueCache;
case vtString:
m_strValueCache = m_value.pszValue;
return m_strValueCache;
case vtDouble:
m_strValueCache.Format(_T("%.13g"), m_value.dValue);
return m_strValueCache;
case vtByte8:
{
DWORD* pd = (DWORD*) &m_value.b8Value;
m_strValueCache.Format(_T("%08x%08x"), pd[0], pd[1]);
return m_strValueCache;
}
default:
m_strValueCache = _T("Value?");
return m_strValueCache;
}
}