次の方法で共有


IKsTopologyInfo::get_NodeName method (vidcap.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The get_NodeName method returns the name of the node.

Syntax

HRESULT get_NodeName(
  [in]  DWORD dwNodeId,
  [out] WCHAR *pwchNodeName,
  [in]  DWORD dwBufSize,
  [out] DWORD *pdwNameLen
);

Parameters

[in] dwNodeId

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

[out] pwchNodeName

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.

[in] dwBufSize

Size of the pwchNodeName array, in bytes.

[out] pdwNameLen

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

Return value

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.

Examples


// 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

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only]
Minimum supported server Windows Server 2003 R2 [desktop apps only]
Target Platform Windows
Header vidcap.h

See also

Error and Success Codes

IKsTopologyInfo Interface