Articles → .NET → Detect webcam programmatically in C#

Detect webcam programmatically in C#

Picture showing the folder structure of a windows based application in visual studio solution explorer

Click to Enlarge

using AForge.Video.DirectShow;

private FilterInfoCollection devices;
string IsWebCamExists = "NOT EXIST";
private void btnDetectWebcam_Click(object sender, EventArgs e) {
  devices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

  if (devices.Count > 0)
    IsWebCamExists = "EXIST";

  MessageBox.Show(string.Format("Webcam Status: {0}", IsWebCamExists));

Posted By  -  Karan Gupta
Posted On  -  Friday, January 23, 2015


Your Email Id  
Query/FeedbackCharacters remaining 250