Share via


IWMDeviceManager2::GetDeviceFromCanonicalName

banner art

The GetDeviceFromCanonicalName method retrieves an IWMDMDevice interface for a device with a specified canonical name. You can retrieve a device's canonical name by calling IWMDMDevice2::GetCanonicalName.

Syntax

HRESULT GetDeviceFromCanonicalName(LPCWSTRpwszCanonicalName,IWMDMDevice**ppDevice);

Parameters

pwszCanonicalName

[in]  A wide-character, null-terminated string specifying the canonical name of the device.

ppDeviceArray

[out]  Pointer to a pointer to the IWMDMDevice interface of the device object with the specified canonical name. The caller must release this interface when done with it.

Return Values

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Value Description
E_INVALIDARG The pwszCanonicalName or ppDeviceArray parameter is an invalid or NULL pointer.
S_FALSE There is no connected device found with canonical name pwszCanonicalName.

Remarks

This method can be useful if an application implements IWMDMNotification, which sends a canonical name notification when a device connects or disconnects from the computer.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also