Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.gif)
| Previous | Next |
IWMSDirectory::GetChildInfo
The GetChildInfo method retrieves information about a specific media element in a directory.
Syntax
HRESULT GetChildInfo( DWORD dwIndex, WMSDirectoryEntryInfo* pInfo );
Parameters
dwIndex
[in] DWORD containing the index number of the media element.
pInfo
[out] Pointer to a WMSDirectoryEntryInfo structure that contains information about the media element.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
| Return code | Description |
| S_FALSE | No media element corresponds to the index provided. |
Remarks
The information that can be retrieved from the GetChildInfo method is dependent upon your implementation.
Example Code
The following example retrieves the name and size of a file from a linked list of user-defined CDirectoryInfo classes. The linked list can be created when the server calls IWMSDataSourcePlugin::OpenDirectory.
// In this example, the CDirectoryInfo class contains the
// following data members.
CDirectoryInfo()
{
m_cRef = 1; // Reference count.
m_pszwName = NULL; // File name.
m_qwSize = 0; // File size.
m_pNext = NULL; // Pointer to the next CDirectoryInfo.
}
HRESULT STDMETHODCALLTYPE
CDirectory::GetChildInfo(
DWORD dwIndex,
WMSDirectoryEntryInfo *pInfo
)
{
HRESULT hr = S_OK;
DWORD dwUrlLength;
// Advance to the indicated position in the directory.
while ( ( m_dwItemNum < dwIndex ) && ( NULL != m_pRecentChild ) )
{
m_pRecentChild = m_pRecentChild->m_pNext;
m_dwItemNum++;
}
// Quit if you are at the end of the directory.
if( NULL == m_pRecentChild )
{
hr = S_FALSE;
goto exit;
}
// Copy the name of the directory from the CDirectoryInfo
// object into the WMSDirectoryEntryInfo structure.
dwUrlLength = wcslen( m_pRecentChild->m_pszwName ) + 1;
pInfo->pstrName = ( LPOLESTR ) CoTaskMemAlloc(
sizeof(OLECHAR) * dwUrlLength );
wcscpy_s( pInfo->pstrName, dwUrlLength, m_pRecentChild->m_pszwName );
// Copy the file size from the CDirectoryInfo object
// into the WMSDirectoryEntryInfo structure.
pInfo->qwSize = m_pRecentChild->m_qwSize;
EXIT:
return( hr );
}
Requirements
Header: datacontainer.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.
See Also
| Previous | Next |