?/TD>
Microsoft DirectX 9.0

IDxDiagContainer::EnumChildContainerNames Method


Enumerates the name of the IDxDiagContainer object at the specified index.

Syntax

HRESULT EnumChildContainerNames(      

    DWORD dwIndex,     LPWSTR pwszContainer,     DWORD cchContainer );

Parameters

dwIndex
[in] Zero-based index of the container object that specifies which child container name to retrieve. If this is outside of the allowable range, E_INVALIDARG is returned.
pwszContainer
[out] Address of a string buffer that receives the unique name of the child container. This should be at least 256 elements. If the buffer is too small, it will return DXDIAG_E_INSUFFICIENT_BUFFER.
cchContainer
[in] Specifies the size of the pwszContainer buffer in characters.

Return Value

Returns S_OK if successful. Otherwise, returns one of the following values.

E_INVALIDARGAn invalid argument was passed to the returning function.
DXDIAG_E_INSUFFICIENT_BUFFERThe buffer is too small.


Example

To enumerate the names of all the child containers, use this method in a loop. This example shows how to get the number of child containers, enumerate the names of all the child containers, and retrieve instances of the child containers.

IDxDiagContainer*   pDxDiagContainer;
IDxDiagContainer*   pChildContainer;
DWORD   dwChildCount;
DWORD   dwChildIndex;
LPWSTR   wszChildName[256];

hr = pDxDiagContainer->GetNumberOfChildContainers( &dwChildCount );
assert( SUCCEEDED(hr) );
 
for( dwChildIndex = 0; dwChildIndex < dwChildCount; dwChildIndex++ )
{
        hr = pDxDiagContainer->EnumChildContainerNames( dwChildIndex, wszChildName, 256 );
        assert( SUCCEEDED(hr) );
 
        hr = pDxDiagContainer->GetChildContainer( wszChildName, &pChildContainer );
        assert( SUCCEEDED(hr) );
 
        // Do something with pChildContainer.
 
        SAFE_RELEASE( pChildContainer );
}




© 2002 Microsoft Corporation. All rights reserved.