共用方式為


IDirectMusic8::EnumPort

The EnumPort method enumerates and retrieves the capabilities of the DirectMusic ports connected to the system. Each time it is called, this method retrieves information about a single port.

Syntax

HRESULT EnumPort(
  DWORD dwIndex, 
  LPDMUS_PORTCAPS pPortCaps 
);

Parameters

dwIndex

Index of the port for which the capabilities are to be returned. This parameter should be 0 on the first call, and then incremented in each subsequent call until S_FALSE is returned.

pPortCaps

Address of the DMUS_PORTCAPS structure that receives the capabilities of the port. The dwSize member of this structure must be initialized before the pointer is passed.

Return Values

If the method succeeds, the return value is S_OK, or S_FALSE if there is no port with that index value.

If it fails, the method can return one of the error values shown in the following table.

Return code
E_INVALIDARG
E_NOINTERFACE
E_POINTER

Remarks

Applications should not rely on or store the index number of a port. Restarting the system or adding or removing ports could cause the index number of a port to change.

Requirements

**  Header:** Dmusicc.h
  Library: Dmusic.dll, Dmusicd.dll

See Also

© 2004 Microsoft Corporation. All rights reserved.