IWMDMStorage::GetName
The GetName method retrieves the display name of the storage.
Syntax
HRESULT GetName(LPWSTRpwszName,UINTnMaxChars);
Parameters
pwszName
[out] Pointer to a wide-character null-terminated string specifying the storage name. This is the display name of the object is the file name without path information. The caller allocates and releases this buffer.
nMaxChars
[in] Integer specifying the maximum number of characters that can be copied to the name 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 | The pwszName parameter is an invalid or NULL pointer. |
E_FAIL | An unspecified error occurred. |
Example Code
The following code retrieves the display name of a storage (pStorage).
// Get the name of the object. The first time this is called on a device, it will
// retrieve '\' as the root folder name.
const UINT MAX_LEN = 255;
WCHAR name[MAX_LEN];
hr = pStorage->GetName((LPWSTR)&name, MAX_LEN);
// TODO: Display the storage name.
Requirements
Header: Defined in mswmdm.h.
Library: mssachlp.lib
See Also