IWMEncDeviceControlPluginInfoManager::Item

Windows Media Encoder SDK banner art

The Item method retrieves registration information for a specific device.

Syntax

HRESULT Item(
  long  iIndex,
  IWMEncPluginInfo**  ppPluginInfo
);

Parameters

iIndex

[in]  A long containing the index of the item in the plug-in collection.

ppPluginInfo

[out]  Pointer to a pointer to an IWMEncPluginInfo interface.

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 indirect pointer to the plug-in object 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\wmdevctl.h"

// Declare variables.
HRESULT hr;
IWMEncoder2* pEncoder;
IWMEncDeviceControlPluginInfoManager* pDCPlugMgr;
IWMEncPluginInfo* pPlugInfo;
int i;
int j;
long lCount;
long lResrcCount;
CComBSTR sScheme;
CComBSTR sName;

    // 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);
    }

    // Retrieve a device plug-in info manager object.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_DeviceControlPluginInfoManager(&pDCPlugMgr);
    }

    // This section shows how to enumerate digital devices such as DV cameras and VTRs.

    // Loop through the devices on the system.
    if ( SUCCEEDED( hr ) )
    {
        hr = pDCPlugMgr->get_Count(&lCount);
    }
    for (i = 0; i < lCount; i++)
    {
        // Set the IWMEncPluginInfo object to the current plug-in.
        if ( SUCCEEDED( hr ) )
        {
            hr = pDCPlugMgr->Item(i, &pPlugInfo);
        }

        // Find the digital devices.
        if ( SUCCEEDED( hr ) )
        {
            hr = pPlugInfo->get_SchemeType(&sScheme);
        }
        if (_wcsicmp(sScheme, CComBSTR("DEVICECONTROL"))==0)
        {
            if ( SUCCEEDED( hr ) )
            {
                hr = pPlugInfo->get_Count(&lResrcCount);
            }
            // Loop through the resources in the current plug-in.
            for (j = 0; j < lResrcCount; j++)
            {
                // Display the name of the plug-in.
                if ( SUCCEEDED( hr ) )
                {
                    hr = pPlugInfo->Item(j, &sName);
                }
                wprintf(CComBSTR("%s\n"), sName);
            }
        }
    }

    // Release pointers.
    if ( pDCPlugMgr )
    {
        pDCPlugMgr->Release();
        pDCPlugMgr = NULL;
    }
    if ( pPlugInfo )
    {
        pPlugInfo->Release();
        pPlugInfo = NULL;
    }
    if ( pEncoder )
    {
        pEncoder->Release();
        pEncoder = NULL;
    }

Requirements

Header: wmdevctl.h

Library: wmdevctl.dll

See Also