Partager via


IWMDMDevice2::GetCanonicalName

banner art

The GetCanonicalPName method gets the canonical name of a device.

Syntax

HRESULT GetCanonicalName(
  LPWSTR  pwszPnPName,
  UINT  nMaxChars
);

Parameters

pwszPnPName

[out]  Wide-character buffer for the canonical names.

nMaxChars

[in]  Integer containing the maximum number of characters that can be placed in pwszPnPName.

Return Values

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

Return code Description
E_INVALIDARG The pwszPnPName parameter is an invalid or NULL pointer.
WMDM_E_NOTSUPPORTED The device does not support a canonical name.
WMDM_E_BUFFERTOOSMALL The buffer specified is too small for the canonical name.
E_FAIL An unspecified error occurred.

Remarks

This method returns a canonical name for the device. The application can later call IWMDeviceManager2::GetDeviceFromCanonicalName by passing this name to obtain an IWMDMDevice interface pointer for this device.

The returned canonical name is in the format of <PnP Device Path>$<index>. The canonical name includes a zero-based index into the device objects returned by the service provider for the specified PnP device path.

The format of canonical name is subject to change in the future releases of Windows Media Device Manager.

Requirements

Header: Defined in wmdm.idl.

Library: mssachlp.lib

See Also