IWMDRMProfileCollection::get_Count

Windows Media Encoder SDK banner art

The get_Count method retrieves the number of DRM profiles in the collection.

Syntax

HRESULT get_Count(
  long*  plCount
);

Parameters

plCount

[out]  Pointer to a long that indicates the number of available DRM profiles.

Return Values

If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.

Return code Number Description
E_POINTER 0x80004003 The pointer to the count is NULL.

Example Code

// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
#include "C:\WMSDK\WMEncSDK9\include\wmdrmprf.h" // for DRM features

HRESULT hr;
IWMEncoder2* pEncoder;
IWMDRMContentAuthor* pDRM;
IWMDRMProfileCollection* pDRMProColl;
IWMDRMProfile* pDRMPro;
IWMDRMAttributes* pProAttr;

    // Initialize the COM library and retrieve a pointer
    // to an IWMEncoder interface.
    hr = CoInitialize(NULL);

    if ( SUCCEEDED( hr ) )
    {
        hr = CoCreateInstance(CLSID_WMEncoder,
            NULL,
            CLSCTX_INPROC_SERVER,
            IID_IWMEncoder2,
            (void**) &pEncoder);
    }

    // Create an IWMDRMContentAuthor object.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_EncoderDRMContentAuthor(&pDRM);
    }

    // Retrieve the collection of DRM profiles.
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRM->get_DRMProfileCollection(&pDRMProColl);
    }


    // Get the count.
    long lCount; 
    if ( SUCCEEDED( hr ) )
    {
        hr = pDRMProColl->get_Count(&lCount);
    }

    // Release pointers.
    if ( pDRM )
    {
        pDRM->Release();
        pDRM = NULL;
    }
    if ( pDRMProColl )
    {
        pDRMProColl->Release();
        pDRMProColl = NULL;
    }
    if ( pDRMPro )
    {
        pDRMPro->Release();
        pDRMPro = NULL;
    }
    if ( pProAttr )
    {
        pProAttr->Release();
        pProAttr = NULL;
    }
    if ( pEncoder )
    {
        pEncoder->Release();
        pEncoder = NULL;
    }

Requirements

Header: wmdrmprf.h

Library: wmenc.exe

See Also