IMDSPDevice::GetName

banner art

The GetName method retrieves the name of the device.

Syntax

HRESULT GetName(LPWSTRpwszName,UINTnMaxChars);

Parameters

pwszName

[out]  Pointer to an array of 16-bit Unicode characters that receives the device name string.

nMaxChars

[in]  Maximum number of characters to copy to the string.

Return Values

The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes

For an extenstive list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK The method succeeded.
E_INVALIDARG A parameter is invalid or is a NULL pointer.
WMDM_E_BUFFERTOOSMALL The buffer specified is too small for the return string. Check nMaxChars for the required buffer size.
E_FAIL An unspecified error occurred.

Remarks

The LPWSTR string type is a 16-bit Unicode character string and does not accept byte-sized characters. To convert a string of byte-sized characters (LPCSTR) to an LPWSTR string, use the MultiByteToWideChar function as described in Microsoft Windows documentation.

Device names must not contain trailing spaces.

This method must be implemented. It must not return WMDM_E_NOTSUPPORTED or E_NOTIMPL. For more information, see Mandatory and Optional Interfaces.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also