IWMDMStorage4::GetParent
The GetParent method retrieves the parent of the current storage.
Syntax
HRESULT GetParent(
IWMDMStorage** ppStorage
);
Parameters
ppStorage
[out] Pointer to the returned parent storage object.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider 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 a complete list of possible error codes, see Error Codes.
Possible values include, but are not limited to, those in the following table. If the method fails with an error, it returns a standard error code.
Return code | Description |
S_OK | The method succeeded and ppStorage holds the IWMDMStorage pointer to the parent object. |
S_FALSE | Current storage is the root storage and therefore has no parent. In this case, ppStorage is set to NULL. |
Remarks
The application can traverse the complete hierarchy of the current storage by calling GetParent recursively. After the root storage is reached, GetParent returns S_FALSE and sets ppStorage to NULL.
Example
HRESULT TraverseHierarchy(IWMDMStorage *pIStorage)
{
HRESULT hr = S_OK;
CComPtr<IWMDMStorage4> spIStg4;
hr = pIStorage->QueryInterface (__uuidof(IWMDMStorage4), reinterpret_cast<void**>(&spIStg4));
if (SUCCEEDED(hr))
{
while ((spIStg4 != NULL))
{
CComPtr<IWMDMStorage> spIParent;
hr = spIStg4->GetParent(&spIParent);
if (FAILED(hr))
{
break;
}
//
//Do something with spIParent.
//
if (S_FALSE != hr)
{
hr = spIParent->QueryInterface (__uuidof(IMDSPStorage4), reinterpret_cast<void**>(&spIStg4));
if (FAILED(hr))
{
break;
}
}
}
}
return hr;
}
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also