IPortableDevice interface

The IPortableDevice interface provides access to a portable device.

To create and open this interface, first call CoCreateInstance with CLSID_PortableDeviceFTM or CLSID_PortableDeviceto retrieve an IPortableDevice interface, and then call Open to open a connection to the device.

Members

The IPortableDevice interface inherits from the IUnknown interface. IPortableDevice also has these types of members:

Methods

The IPortableDevice interface has these methods.

MethodDescription
Advise

Registers an application-defined callback that receives device events.

Cancel

Cancels a pending operation on this interface.

Capabilities

Retrieves an interface used to query the capabilities of a portable device.

Close

Closes the connection with the device.

Content

Retrieves an interface used to access objects on a device.

GetPnPDeviceID

Retrieves a Plug-and-Play (PnP) identifier used to open a device.

Open

Opens a connection between the application and the device.

SendCommand

Sends a command to the device and retrieves the results synchronously.

Unadvise

Unregisters a client from receiving callback notifications.

 

Remarks

The client interfaces are designed to be used for any WPD object; it is not necessary to create a new instance for each object referenced by the application. After an application opens an instance of the IPortableDevice interface, it should open and cache any other WPD client interfaces that it will require.

For Windows 7, IPortableDevice supports two CLSIDs for CoCreateInstance. CLSID_PortableDevice returns an IPortableDevice pointer that does not aggregate the free-threaded marshaler; CLSID_PortableDeviceFTM is a new CLSID that returns an IPortableDevice pointer that aggregates the free-threaded marshaler. Both pointers support the same functionality otherwise.

Applications that live in Single Threaded Apartments should use CLSID_PortableDeviceFTM as this eliminates the overhead of interface pointer marshaling. CLSID_PortableDevice is still supported for legacy applications.

Requirements

Header

PortableDeviceApi.h

Library

PortableDeviceGUIDs.lib

See also

Client Interfaces

 

 

Community Additions

ADD
Show:
© 2014 Microsoft