ICreateDevEnum Interface


The ICreateDevEnum interface creates an enumerator for a list of objects; typically, these objects are instances of hardware devices. Use this enumerator to access the objects' interfaces, methods, and data. This enumerator supports the same methods as all enumerator interfaces: Next, Skip, Reset, and Clone. For more information on using enumerators, see the Win32 IEnumXXXX interface documentation.

The ICreateDevEnum interface implements plug-and-play functionality to enumerate devices; DirectShow provides additional plug-and-play functionality through the Win32 IPropertyBag and IPersistPropertyBag interfaces; see the appropriate documentation for more details.

When to Implement

Implement this interface when you want to obtain lists of a specific category of objects. The object must have an internal structure that allows enumeration.

When to Use

Applications need a simple method of finding and creating instances of objects that represent the machine's devices. To obtain these instances, you should first create a system device enumerator object, and then use it to create an enumerator for the particular class of device that interests you. DirectShow typically uses this enumerator to create a list of the machine's video capture devices, which you can then use in your applications or present in some fashion to the user.

Methods in Vtable Order
IUnknown methods Description
QueryInterface Retrieves pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
ICreateDevEnum methods Description
CreateClassEnumerator Creates a class enumerator for the specified category.


ICreateDevEnum::CreateClassEnumerator

ICreateDevEnum Interface

Creates an enumerator for the specified type of object.

HRESULT CreateClassEnumerator(
  REFCLSID clsidDeviceClass,
  IEnumMoniker ** ppEnumMoniker,
  DWORD dwFlags
  );

Parameters
clsidDeviceClass
[in] REFCLSID value that specifies the type of object or device to enumerate.
ppEnumMoniker
[out] Address of a pointer to the Win32 IEnumMoniker (or derived) interface implemented by the new class enumerator.
dwFlags
[in] Combination of flags that modifies how DirectShow creates the enumerator; for example, an application can use a flag to skip devices that have already been enumerated or that do not support persistant storage of their device properties (CLSID, FriendlyName, and DevicePath).
Return Values

Return one of the following values.
Value Meaning
NOERROR Success.
E_OUTOFMEMORY There is not enough memory available to create a class enumerator.
S_FALSE The category specified by clsidDeviceClass does not exist.

Remarks

The new class enumerator is a nonaggregate object that will run in the same process as the class that called this method.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.