IWMSFileDescription Interface

banner art

Previous Next

IWMSFileDescription Interface

You can use the IWMSFileDescription interface to describe a directory, media file, or playlist file.

In addition to the methods inherited from IDispatch, the IWMSFileDescription interface exposes the following methods.

Method Description
get_Name Retrieves the name of a directory, media file, or playlist file.
get_Type Retrieves an enumeration value that indicates whether the IWMSFileDescription interface describes a directory, a media file, or a playlist file.

Example Code

The following example illustrates how to retrieve a pointer to an IWMSFileDescription interface.

#include <windows.h>
#include <atlbase.h>    // Includes CComBSTR and CComVariant.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer              *pServer;
IWMSFileDescriptions    *pFileDescriptions;
IWMSFileDescription     *pFileDescription;

HRESULT         hr;
CComVariant     varIndex;
CComBSTR        bstrPath;
long            lCount;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IWMSFileDescriptions interface
// and retrieve the total count of descriptions.
bstrPath = "file://c:\\wmpub\\wmroot";
hr = pServer->get_FileDescriptions(bstrPath,
                                   WMS_FILE_UNSPECIFIED,
                                   &pFileDescriptions);
if (FAILED(hr)) goto EXIT;
hr = pFileDescriptions->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// Retrieve information associated with each description.
for (long x = 0; x < lCount; x++) {
    varIndex = x;
    hr = pFileDescriptions->get_Item(varIndex, &pFileDescription);
    if (FAILED(hr)) goto EXIT;

    // Release temporary COM objects.
    pFileDescription->Release();
}

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

See Also

Previous Next