Share via


IWMSContentDescriptionList::AppendDescription

banner art

Previous Next

IWMSContentDescriptionList::AppendDescription

The AppendDescription method adds an IWMSContext interface containing a content description context to the description list.

Syntax

  HRESULT AppendDescription(
  LPCWSTR  pstrLanguage,
  IWMSContext*  pDescription
);

Parameters

pstrLanguage

[in] LPCWSTR specifying the national language used in the description.

pDescription

[in] Pointer to an IWMSContext interface.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code Number Description
E_INVALIDARG 0x80070057 The pstrLanguage parameter or the pDescription parameter is NULL, or the pstrLanguage string contains too many characters.
E_UNEXPECTED 0x8000FFFF The server could not allocate another description list.

Example Code

// Use a pointer to an IWMSClassObject interface, pFactory,
// to create an empty content description list. The server sends 
// your plug-in a pointer to the IWMSClassObject interface when 
// it calls the IWMSBasicPlugin::InitializePlugin method.
if(NULL != pFactory)
{
    hr = pFactory->CreateInstance(
                        IID_IWMSContentDescriptionList,
                        (void **) &m_pContentDescriptionList );
    if (FAILED(hr)) goto EXIT;

    // Create a content description context. The return value,
    // pContentDescription, contains a pointer to the context.
    hr = pFactory->AllocIWMSContext(
                        IID_IWMSContext,
                        WMS_CONTENT_DESCRIPTION_CONTEXT_TYPE,
                        NULL,
                        (void **) &pContentDescription );
    if (FAILED(hr)) goto EXIT;

    // Create a content description object. The class 
    // CContentDescriptionObject is user-defined. In this
    // example, it contains data members and implements
    // methods that contain information describing the content.
    CContentDescriptionObject cdo;

    // Add the title to the content description context.
    hr = pContentDescription->SetStringValue(
                        WMS_CONTENT_DESCRIPTION_TITLE,
                        WMS_CONTENT_DESCRIPTION_TITLE_ID,
                        cdo.GetTitle(),
                        0 );
    if (FAILED(hr)) goto EXIT;

    // Add the author to the content description context.
    hr = pContentDescription->SetStringValue(
                    WMS_CONTENT_DESCRIPTION_AUTHOR,
                    WMS_CONTENT_DESCRIPTION_AUTHOR_ID,
                    cdo.GetAuthor(),
                    0 );
    if (FAILED(hr)) goto EXIT;

    // Add the copyright to the content description context.
    hr = pContentDescription->SetStringValue(
                        WMS_CONTENT_DESCRIPTION_COPYRIGHT,
                        WMS_CONTENT_DESCRIPTION_COPYRIGHT_ID,
                        cdo.GetCopyright(),
                        0 );
    if (FAILED(hr)) goto EXIT;

    // Add the description to the content description context.
    hr = pContentDescription->SetStringValue(
                        WMS_CONTENT_DESCRIPTION_DESCRIPTION,
                        WMS_CONTENT_DESCRIPTION_DESCRIPTION_ID,
                        cdo.GetDescription(),
                        0 );
    if (FAILED(hr)) goto EXIT;

    // Add rating information to the content description context.
    hr = pContentDescription->SetStringValue(
                        WMS_CONTENT_DESCRIPTION_RATING,
                        WMS_CONTENT_DESCRIPTION_RATING_ID,
                        cdo.GetRating(),
                        0 );
    if (FAILED(hr)) goto EXIT;

    // Add the content description to the content description
    // list.
    hr = m_pContentDescriptionList->AppendDescription( 
                                 L"en-us",
                                 pContentDescription );
    if (FAILED(hr)) goto EXIT;

}

EXIT:
    // TODO: Release temporary objects.

Requirements

Header: streamdescription.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next