By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,061 Members | 1,539 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,061 IT Pros & Developers. It's quick & easy.

How to find dshow devices that are on the computer

IronRazer
P: 83
I am making a program that uses dshow devices. I need to find the names of the device or devices such as "SoundMAX Digital Audio" or "SoC PC-Camra". How do i get the names and put them into a listbox so i can choose the device i want to use ? I only need the audio devices but i can filter out the rest if i can just figure out how to get the name.

Thank you in advance to those that help me.
Jan 14 '13 #1

✓ answered by IronRazer

After searching for ways to get the audio device names i figured out how to get them using the DirectX SDK. However if someone has any ideas on why the shell command in VB will not let ffmpeg write the text file that would be nice to know. This is not the first time i had that problem.

This is how to get your audio devices :

1. Install DirectX SDK from Microsoft Download Center.
2. Go to Project/Add Resource (.net) tab and select Microsoft.DirectX.Sound

Now use this code to put the names into a combobox.

Expand|Select|Wrap|Line Numbers
  1. Imports Microsoft.DirectX.DirectSound
  2.  
  3. Public Class GetDevices
  4.  
  5.     Private Sub GetDevices_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6.         FindDevices()
  7.     End Sub
  8.  
  9.     Public Sub FindDevices()
  10.         Dim AudioDevices As New CaptureDevicesCollection
  11.         For x = 0 To AudioDevices.Count - 1
  12.             ComboBox1.Items.Add(AudioDevices.Item(x).Description)
  13.             End If
  14.         Next
  15.         ComboBox1.SelectedIndex = 0
  16.     End Sub
  17.  
When the form loads it will list devices in the combobox.

Enjoy !!!!

Share this Question
Share on Google+
3 Replies


PsychoCoder
Expert Mod 100+
P: 465
Bytes.com isn't a code or homework service, we're a community of like minded people who come together to help those who are willing to help themselves.

Show us what you've tried and we will do everything we can to nudge you in the right direction but we will not just do the work for you.
Jan 14 '13 #2

IronRazer
P: 83
Sorry for sounding like i want the work done for me, I just need to know how to go about doing this. My program uses ffmpeg and this is how you get the names i need using it. From a standard cmd prompt i can run this ffmpeg command :

Expand|Select|Wrap|Line Numbers
  1. ffmpeg -list_devices true -f dshow -i dummy >info.txt 2>>&1
  2.  
and it writes the output to a text file just fine but, if i run it from a Shell command or by using a Process in vb it runs the command but it fails to write the info to a text file. I have tried several ways using :

Expand|Select|Wrap|Line Numbers
  1. Shell("ffmpeg -list_devices true -f dshow -i dummy >info.txt 2>>&1")
  2.  
All other ffmpeg commands work fine that i send from my program except this one. I even tried having my program run a batch file that works from a cmd prompt but, run from vb cmd shell it fails to make the text file also. Is there some reason that the cmd shell in vb won`t work?
I was told maybe using WMI might work to get the names of devices but, i can`t find a good example anywhere of how to use WMI and don`t quite understand it yet.
Do you know why Shell command dosn`t let ffmpeg write the text file or can you direct me to a good WMI example ?

PS. I am running XP Pro SP3 as the administrator.
Jan 15 '13 #3

IronRazer
P: 83
After searching for ways to get the audio device names i figured out how to get them using the DirectX SDK. However if someone has any ideas on why the shell command in VB will not let ffmpeg write the text file that would be nice to know. This is not the first time i had that problem.

This is how to get your audio devices :

1. Install DirectX SDK from Microsoft Download Center.
2. Go to Project/Add Resource (.net) tab and select Microsoft.DirectX.Sound

Now use this code to put the names into a combobox.

Expand|Select|Wrap|Line Numbers
  1. Imports Microsoft.DirectX.DirectSound
  2.  
  3. Public Class GetDevices
  4.  
  5.     Private Sub GetDevices_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6.         FindDevices()
  7.     End Sub
  8.  
  9.     Public Sub FindDevices()
  10.         Dim AudioDevices As New CaptureDevicesCollection
  11.         For x = 0 To AudioDevices.Count - 1
  12.             ComboBox1.Items.Add(AudioDevices.Item(x).Description)
  13.             End If
  14.         Next
  15.         ComboBox1.SelectedIndex = 0
  16.     End Sub
  17.  
When the form loads it will list devices in the combobox.

Enjoy !!!!
Jan 17 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.