IPortableDeviceDispatchFactory::GetDeviceDispatch method (portabledeviceapi.h)

Instantiates a WPD Automation Device object for a given WPD device identifier.


HRESULT GetDeviceDispatch(
  [in]  LPCWSTR   pszPnPDeviceID,
  [out] IDispatch **ppDeviceDispatch


[in] pszPnPDeviceID

A pointer to a String that is used by Plug-and-play to identify a currently connected WPD device. The Plug and Play (PnP) identifier for a particular device can be obtained from the IPortableDeviceManager::GetDevices method in the WPD C++/COM API.

[out] ppDeviceDispatch

Contains a pointer to the IDispatch implementation for the WPD Automation Device object.

Return value

The possible return codes include, but are not limited to, the values shown in the following table.

Return code Description
The method succeeded.


For an example of how to use GetDeviceDispatch method to instantiate a WPD Automation Device object, see Instantiating the WPD Automation Factory Interface.


Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header portabledeviceapi.h
Library PortableDeviceGuids.lib

See also

Device Object

IPortableDeviceDispatchFactory Interface

Instantiating the WPD Automation Factory Interface