How to find dshow devices that are on the computer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IronRazer
    New Member
    • Jan 2013
    • 83

    How to find dshow devices that are on the computer

    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.
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    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.

    Comment

    • IronRazer
      New Member
      • Jan 2013
      • 83

      #3
      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 :

      Code:
      ffmpeg -list_devices true -f dshow -i dummy >info.txt 2>>&1
      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 :

      Code:
      Shell("ffmpeg -list_devices true -f dshow -i dummy >info.txt 2>>&1")
      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.
      Last edited by IronRazer; Jan 17 '13, 08:57 PM. Reason: I forgot to use code tags

      Comment

      • IronRazer
        New Member
        • Jan 2013
        • 83

        #4
        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.Direc tX.Sound

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

        Code:
        Imports Microsoft.DirectX.DirectSound
        
        Public Class GetDevices
        
            Private Sub GetDevices_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                FindDevices()
            End Sub
        
            Public Sub FindDevices()
                Dim AudioDevices As New CaptureDevicesCollection
                For x = 0 To AudioDevices.Count - 1
                    ComboBox1.Items.Add(AudioDevices.Item(x).Description)
                    End If
                Next
                ComboBox1.SelectedIndex = 0
            End Sub
        When the form loads it will list devices in the combobox.

        Enjoy !!!!

        Comment

        Working...