Partager via


About Devices

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Portable devices are hardware devices that users carry to enjoy digital media content when they are away from their computer. Typically, portable devices are battery operated. Some devices can play music only. Other devices can play video and music.

Some devices support automatic synchronization of digital media content with Windows Media Player. Other devices support only manual transfer. You can determine whether a particular device supports automatic synchronization by calling IWMPSyncDevice::get_status and then inspecting the WMPDeviceStatus value retrieved. If the retrieved value is wmpdsManualDevice, the device does not support automatic synchronization.

You can enumerate the devices connected to the user's computer. To do this, first use IWMPSyncServices::get_deviceCount to retrieve the count of devices. Then, in a loop, call IWMPSyncServices::getDevice, passing the appropriate index value each time. You can use IWMPSyncDevice::get_connected to evaluate whether a particular device is currently connected.

To know when devices connect or disconnect, you can receive the DeviceConnect and DeviceDisconnect events. These events are received through the IWMPEvents2 interface.

The IWMPSyncDevice interface provides additional methods to enable you to get or set information about a device. For example:

  • The get_FriendlyName and put_FriendlyName methods enable you to retrieve and specify the user-defined device name.
  • The get_deviceName method enables you to retrieve the device name that users see in the Windows XP shell.
  • The getItemInfo method enables you to retrieve metadata from devices.

About Device Synchronization

IWMPEvents2 Interface

IWMPSyncDevice Interface

Working with Portable Devices