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; Microsoft® DirectShow® provides additional Plug and Play functionality through the Win32 IPropertyBag and IPersistPropertyBag interfaces; see the appropriate documentation for more details.
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.
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.
Creates an enumerator for the specified type of object.
Syntax
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). Possible flags include the following:
CDEF_CLASS_DEFAULT Default value. CDEF_BYPASS_CLASS_MANAGER Enumerate devices in the registry without using a class manager. CDEF_MERIT_ABOVE_DO_NOT_USE Enumerate devices with a merit above MERIT_DO_NOT_USE.
Return Value
Returns one of the following values.
NOERROR Success. S_OK 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
If no devices are found, the method does not return with a moniker of zero elements, instead, no moniker is returned.
The new class enumerator is a nonaggregate object that will run in the same process as the class that called this method.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.