共用方式為


IWMDeviceManager::EnumDevices

banner art

The EnumDevices method retrieves a pointer to the IWMDMEnumDevice interface that can be used to enumerate portable devices connected to the computer.

Syntax

HRESULT EnumDevices(IWMDMEnumDevice**ppEnumDevice);

Parameters

ppEnumDevice

[out]  Pointer to a pointer to an IWMDMEnumDevice interface used to enumerate devices. The caller must release this interface when done with it.

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.
E_INVALIDARG The ppEnumDevice parameter is an invalid or NULL pointer.
E_FAIL An unspecified error occurred.

Remarks

This method returns devices based on earlier versions of Windows Media Device Manager. To get all devices, including newer devices (such as MTP devices), call IWMDMDeviceManager2::EnumDevices2.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also