IPortableDevice interface (portabledeviceapi.h)
The IPortableDevice interface provides access to a portable device.
To create and open this interface, first call CoCreateInstance with CLSID_PortableDeviceFTM or CLSID_PortableDevice to retrieve an IPortableDevice interface, and then call Open to open a connection to the device.
Inheritance
The IPortableDevice interface inherits from the IUnknown interface. IPortableDevice also has these types of members:
Methods
The IPortableDevice interface has these methods.
IPortableDevice::Advise The Advise method registers an application-defined callback that receives device events. |
IPortableDevice::Cancel The Cancel method cancels a pending operation on this interface. |
IPortableDevice::Capabilities The Capabilities method retrieves an interface used to query the capabilities of a portable device. |
IPortableDevice::Close The Close method closes the connection with the device. |
IPortableDevice::Content The Content method retrieves an interface that you can use to access objects on a device. |
IPortableDevice::GetPnPDeviceID The GetPnPDeviceID method retrieves the Plug and Play (PnP) device identifier that the application used to open the device. |
IPortableDevice::Open The Open method opens a connection between the application and the device. |
IPortableDevice::SendCommand The SendCommand method sends a command to the device and retrieves the results synchronously. |
IPortableDevice::Unadvise The Unadvise method unregisters a client from receiving callback notifications. You must call this method if you called Advise previously. |
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
Requirement | Value |
---|---|
Target Platform | Windows |
Header | portabledeviceapi.h |