banner art

The Next method retrieves a pointer to the next celt IMDSPDevice interfaces.


HRESULT Next(ULONGcelt,IMDSPDevice**ppDevice,ULONG*pceltFetched);



[in]  Number of devices requested.


[out]  Array of celt pointers IMDSPDevice allocated by the caller. Return NULL to indicate that no more devices exist or an error has occurred. If celt is more than 1, the caller must allocate enough memory to store celt number of interface pointers.


[out]  Pointer to a ULONG variable that receives the number of interfaces retrieved.

Return Values

The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes

For an extenstive list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
S_FALSE The number of elements retrieved is less than celt.
E_FAIL An unspecified error occurred.
E_OUTOFMEMORY Not enough memory to create device objects.


When there are no more service provider interfaces for enumerated devices, or when there are fewer of these interfaces than requested by the celt parameter, the return value from Next is S_FALSE. When this happens, the pceltFetched parameter must be queried to determine how many interfaces, if any, were returned.

The device enumerator may not reflect the effect of device insertion and removal.

This method must be implemented. It must not return WMDM_E_NOTSUPPORTED or E_NOTIMPL. For more information, see Mandatory and Optional Interfaces.


Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also