IDiaPropertyStorage

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Allows you to read the persistent properties of a DIA property set.

Syntax

IDiaPropertyStorage : IUnknown

Methods in Vtable Order

The following table shows the methods of IDiaPropertyStorage.

Method Description
IDiaPropertyStorage::Enum Gets a pointer to an enumerator for properties within this set.
IDiaPropertyStorage::ReadBOOL Reads BOOL values in a property set.
IDiaPropertyStorage::ReadBSTR Reads BSTR values in a property set.
IDiaPropertyStorage::ReadDWORD Reads DWORD values in a property set.
IDiaPropertyStorage::ReadLONG Reads LONG values in a property set.
IDiaPropertyStorage::ReadMultiple Reads property values in a property set.
IDiaPropertyStorage::ReadPropertyNames Gets corresponding string names for given property identifiers.
IDiaPropertyStorage::ReadULONGLONG Reads ULONGLONG values in a property set.

Remarks

Each property within a property set is identified by a property identifier (ID), a four-byte ULONG value unique to that set. The properties exposed through the IDiaPropertyStorage interface correspond to the properties available in the parent interface. For example, the properties of the IDiaSymbol interface can be accessed by name through the IDiaPropertyStorage interface (note, however, that even though the property may be accessible, it does not mean the property is valid for a particular IDiaSymbol object).

Notes for Callers

Obtain this interface by calling the QueryInterface method on another interface. The following interfaces can be queried for the IDiaPropertyStorage interface:

Example

This example shows a function that displays all properties exposed by the IDiaPropertyStorage object. See the IDiaEnumInjectedSources interface for an example of how the IDiaPropertyStorage interface is obtained from the IDiaInjectedSource interface.

void PrintPropertyStorage(IDiaPropertyStorage* pPropertyStorage)
{
    IEnumSTATPROPSTG* pEnumProps;
    STATPROPSTG       prop;
    DWORD             celt = 1;

    if (pPropertyStorage->Enum(&pEnumProps) == S_OK)
    {
        while (pEnumProps->Next(celt, &prop, &celt) == S_OK)
        {
            PROPSPEC pspec = { PRSPEC_PROPID, prop.propid };
            PROPVARIANT vt = { VT_EMPTY };

            if (pPropertyStorage->ReadMultiple( 1, &pspec, &vt) == S_OK)
            {
                switch( vt.vt ){
                    case VT_BOOL:
                        wprintf( L"%32s:\t %s\n", prop.lpwstrName, vt.bVal ? L"true" : L"false" );
                        break;
                    case VT_I2:
                        wprintf( L"%32s:\t %d\n", prop.lpwstrName, vt.iVal );
                        break;
                    case VT_UI2:
                        wprintf( L"%32s:\t %d\n", prop.lpwstrName, vt.uiVal );
                        break;
                    case VT_I4:
                        wprintf( L"%32s:\t %d\n", prop.lpwstrName, vt.intVal );
                        break;
                    case VT_UI4:
                        wprintf( L"%32s:\t 0x%0x\n", prop.lpwstrName, vt.uintVal );
                        break;
                    case VT_UI8:
                        wprintf( L"%32s:\t 0x%x\n", prop.lpwstrName, vt.uhVal.QuadPart );
                        break;
                    case VT_BSTR:
                        wprintf( L"%32s:\t %s\n", prop.lpwstrName, vt.bstrVal );
                        break;
                    case VT_UNKNOWN:
                        wprintf( L"%32s:\t %p\n", prop.lpwstrName, vt.punkVal );
                        break;
                    case VT_SAFEARRAY:
                        break;
                    default:
                       break;
                }
                VariantClear((VARIANTARG*) &vt);
            }
        }
        pEnumProps->Release();
    }
}

Requirements

Header: Dia2.h

Library: diaguids.lib

DLL: msdia80.dll

See also