IWMEncDeviceControlPluginInfoManager::get_Count
![]() |
The get_Count method retrieves the number of registered devices.
Syntax
HRESULT get_Count(
long* plCount
);
Parameters
plCount
[out] Pointer to a long that indicates the number of items.
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\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
.gif)