I have searched for several days to no avail. I am trying to simply list to a text file the Image Device Names i.e. webcams using c#. I know I can use System.IO.Ports to get comports, which I am doing, but I cannot find a simple way to list the Image Devices.
I have been able to find the WIA devices with this code but not non-WIA Devices:
private static void DoWork()
{
var deviceManager1 = new DeviceManager();
for (int i = 1; (i <= deviceManager1.DeviceInfos.Count); i++)
{
// if (deviceManager1.DeviceInfos[i].Type !=
WiaDeviceType.VideoDeviceType) { continue; }
Console.WriteLine(deviceManager1.DeviceInfos[i].
Properties["Name"].get_Value(). ToString());
}
As I answered in this question, you can do it without external libraries by using WMI.
Add
using System.Management;
and then: