I want to take photos from webcam using C# application. First of all I'm going to get list of all webcams on PC. I find this example:
System.Collections.Generic.List<DeviceInfoClass> devs =
new List<DeviceInfoClass>();
WIA.Collection devsCol =
this.WiaObj.Devices as WIALib.CollectionClass;
foreach (object obj in devsCol)
{
WIA.DeviceInfoClass dev = (WIA.DeviceInfoClass)
System.Runtime.InteropServices.Marshal.CreateWrapperOfType(
obj, typeof(WIA.DeviceInfoClass));
if (dev.Type.Contains("Video") == true)
{
devs.Add(dev);
}
else
{
Marshal.FinalReleaseComObject(obj);
Marshal.FinalReleaseComObject(dev);
}
}
Devices = devs.ToArray();
if (Devices.Length > 0)
{
DefaultDevice = Devices[0];
}
else
{
throw new Exception("No Cameras Detected");
}
Marshal.FinalReleaseComObject(devsCol);
GC.ReRegisterForFinalize(devs);
But the problem is that I have Win 7 and using Wia 2.0(wiaut.dll) and there is no CollectionClass. So, how can I get list of all webcams using WiA 2.0(wiaut.dll)?