Freigeben über


IKsTopologyInfo::get_NodeName

 
Microsoft DirectShow 9.0

IKsTopologyInfo::get_NodeName

This topic applies to Windows XP Service Pack 2 and later.

The get_NodeName method returns the name of the node.

Syntax

  HRESULT get_NodeName(
  DWORD  dwNodeId,
  WCHAR*  pwchNodeName,
  DWORD  dwBufSize,
  DWORD*  pdwNameLen
);

Parameters

dwNodeId

[in]  Index of the node. To find the number of nodes, call the IKsTopologyInfo::get_NumNodes method.

pwchNodeName

[out]  Pointer to a wide-character array that receives the name. To find the required buffer size, set this parameter to NULL. The size is returned in the pdwNameLen parameter.

dwBufSize

[in]  Size of the pwchNodeName array, in bytes.

pdwNameLen

[out]  Receives the buffer size required to hold the name, in bytes. This parameter cannot be NULL.

Return Values

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
__WIN32_FROM_HRESULT(ERROR_MORE_DATA) The buffer is not large enough.

Remarks

To find the buffer size for the name, call the method once with NULL for the pwchNodeName parameter and zero for the dwBufSize parameter. The method returns the buffer size in pdwNameLen. The method's return value, in this case, is __HRESULT_FROM_WIN32(ERROR_MORE_DATA). Then allocate the array and call the method again.

Example Code

// pKsTopo is an IKsTopologyInfo pointer.
// iNode is the index of a node.
DWORD cbName = 0;
hr = pKsTopo->get_NodeName(iNode, NULL, 0, &cbName);
if (hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA))
{
    if (cbName > sizeof(WCHAR))
    {
        WCHAR *nodeName = new WCHAR[cbName / sizeof(WCHAR)];
        if (nodeName == NULL)
        {
            hr = E_OUTOFMEMORY;
        }
        else
        {
            hr = pKsTopo->get_NodeName(iNode, nodeName, cbName, &cbName);
            /* ... */
            delete [] nodeName;
        }
    }
}

Requirements

Header: Include Vidcap.h.

Library: None.

See Also