Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[c#] How to get all video and audio devices;
#1
Well today im going to show you how to get all audio & video devices on a machine, these will be loaded on form load and displayed in a listbox.
  • Step 1
    • Download this .rar with the necessary .DLLs. Link below
    • Microsoft.Expression.Encoder.Utilities.dll, Microsoft.Expression.Encoder.Types.dll, Microsoft.Expression.Encoder.dll, Microsoft.Expression.Encoder.Api2.dll.
      • 'Link'
      • Extract the.DLLs to a your desktop or a folder.

  • Step 2
    • Now in visual studio create a new project named GetDevices.
    • Next right click GetDevices in your Solution Explorer and click Add Reference.
    • Now select a .Dll and press Add.
    • Next do this for all the other .DLLs in which I supplied you.


  • Step 3
    • Now double click on form1.
    • Look for namespace GetDevices, above it Replace all the text with this.
      • Quote:using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Linq;
        using System.Text;
        using System.Windows.Forms;
        using Microsoft.Expression.Encoder.Devices;
        using Microsoft.Expression.Encoder.Live;
        using System.Runtime.InteropServices;


  • Step 4
    • Go back to to Form1.cs[Design]
    • Add 2 listboxes, name one LstAudio, and the other LstVideo.
    • Navigate back to form1.cs[Code]
    • In private void Form1_Load(object sender, EventArgs e) add this code.
      • Quote:foreach (EncoderDevice edv in EncoderDevices.FindDevices(EncoderDeviceType.Video))
        {
        lstVideo.Items.Add(edv.Name);
        }
        foreach (EncoderDevice eda in EncoderDevices.FindDevices(EncoderDeviceType.Audio))
        {
        LstAudio.Items.Add(eda.Name);
        }
Try it out.
So this is my first c# application. This tutorial was made by me, but the inspiration came from another site.
Reply
#2
Nice thanks for the RCDA Big Grin This could be very useful.
[Image: in0rjy.gif]
Reply
#3
Saw this at HF a few hours ago, thanks though!
Reply
#4
Thanks for this. Didn't see it on HF but still well worth the release and viewing to bad vb.net is all screwed up.
Reply
#5
Thanks for sharing this, bro.,
I think I'm gonna try n use this on something..
if ( ( youAreHappy) && (youKnowIt) )

clapYourHands();
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)