Microsoft DirectX 9.0

ITuningSpaceContainer::get_Item

The get_Item method retrieves a tuning space with the specified ID.

Syntax

HRESULT get_Item(
    VARIANT varIndex,
    ITuningSpace** ppTuningSpace
    );

Parameters

varIndex

[in]  VARIANT that specifies the ID of the tuning space.

ppTuningSpace

[out] Address of an ITuningSpace interface pointer that will be set to the returned interface.

Return Values

Returns S_OK if successful. If the method fails, error information can be retrieved using the standard COM IErrorInfo interface.

Remarks

Tuning spaces are identified by ID number. The ID number is unique within the collection. The range of valid IDs is not guaranteed to be contiguous; there may be holes if tuning spaces are added and then removed.

Example Code

CComPtr <ITuningSpaceContainer>  pTuningSpaceContainer;
// Create the SystemTuningSpaces object (not shown).

long cCount = 0;
long ID = 1; // zero is not a valid ID.
hr = pTuningSpaceContainer->get_Count(&cCount);
if (SUCCEEDED(hr))
{
    while (cCount)
    {
        CComPtr<ITuningSpace> pTuningSpace;
        CComVariant varIndex(ID);
        hr = pITuningSpaceContainer->get_Item(varIndex, &pTuningSpace);
        if (SUCCEEDED(hr))
        {
             // pTuningSpace now points to the tuning space with this ID.
             --cCount;
        }
        ID++; // incremement for the next ID.
    }
}

See Also