Microsoft DirectX 9.0

IDxDiagContainer::GetChildContainer Method

Retrieves a pointer to the child container specified.


HRESULT GetChildContainer(      

    LPCWSTR pwszContainer,     IDxDiagContainer **ppInstance );


[in] Specifies the NULL-terminated name of the container.
[out] Receives an instance of the child IDxDiagContainer specified by pwszContainer.

Return Value

If unsuccessful, returns one of the following values.

E_INVALIDARGAn invalid argument was passed to the returning function.
E_OUTOFMEMORYCould not allocate sufficient memory to complete the call.


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.