none
Device enumeration RRS feed

  • Question

  • Hello. I want to enumerate a list of video devices connected to my pc. It includes an AV TV card with four channels(want to list each channel) and a webcam. Any idea as to how i can do this in c#?
    Monday, April 2, 2007 7:35 PM

Answers

  •  

    Hi,

    It's very easy using win32_classes .

    You need to add the System.Manangement dll.It seems.

     You need to use System.Management name space.

    A small sample written by me ,posted below.

     


    private static void Main(string[] args)

    {

    ManagementClass class1 = new ManagementClass("Win32_VideoController");

    foreach (ManagementObject ob in class1.GetInstances())

    {

    foreach(PropertyData pd in ob.Properties)

    {

    if (pd.Name != null)

    Console.WriteLine(" Name " + pd.Name);

    if(pd.Value != null)

    Console.WriteLine(" Value " + pd.Value);

    }

    }


     

     

    Thanks&Best Regards,

    Ch.T.Gopi Kumar

    Tuesday, April 3, 2007 3:34 PM

All replies

  • Hi,

    See these Win32_classes .may help you.

    http://msdn2.microsoft.com/en-us/library/aa394511.aspx

     

    Thanks & Best Regards,

    Ch.T.Gopi Kumar.

    Tuesday, April 3, 2007 6:38 AM
  • Sorry  Tilak, it didnt help; I dont even know where to look, all the samples are in c++, i need some c-sharp examples.
    Tuesday, April 3, 2007 2:38 PM
  •  

    Hi,

    It's very easy using win32_classes .

    You need to add the System.Manangement dll.It seems.

     You need to use System.Management name space.

    A small sample written by me ,posted below.

     


    private static void Main(string[] args)

    {

    ManagementClass class1 = new ManagementClass("Win32_VideoController");

    foreach (ManagementObject ob in class1.GetInstances())

    {

    foreach(PropertyData pd in ob.Properties)

    {

    if (pd.Name != null)

    Console.WriteLine(" Name " + pd.Name);

    if(pd.Value != null)

    Console.WriteLine(" Value " + pd.Value);

    }

    }


     

     

    Thanks&Best Regards,

    Ch.T.Gopi Kumar

    Tuesday, April 3, 2007 3:34 PM
  • Awesome example. Is there a win32 class which i can use to enumerate video input devices only? I think VideoController only displays information about the video controllers in the motherboard; I need a class which can enumerate webcams and Video capture cards. Thanks again.
    Tuesday, April 3, 2007 5:40 PM
  • Hi,

    I don't exactly know ,which class it is.

    But some class should be there.

    Just check here

    http://msdn2.microsoft.com/en-us/library/aa389273.aspx

     

    Thanks & Best Regards,

    Ch.T.Gopi Kumar.

    Wednesday, April 4, 2007 5:09 AM