05-29-2011, 02:00 AM
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.
So this is my first c# application. This tutorial was made by me, but the inspiration came from another site.
- 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.
- 'Link'
- Download this .rar with the necessary .DLLs. Link below
- 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.
- Now in visual studio create a new project named GetDevices.
- 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;
- Now double click on form1.
- 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);
}
- Go back to to Form1.cs[Design]
So this is my first c# application. This tutorial was made by me, but the inspiration came from another site.