|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
listing all audio devicesHi All
I am attempting to create a record and play project that uses mci to record and play audio files. I would like to present the user a list of all mci compatible audio devices on the computer. I have been researching this on the web for days with no concrete results. Can anyone make a suggestion please. Thanks Mickey I am not sure how much help this will be, but you can get a list of audio
devices from SAPI. Also, as follows InfoWrite is just a print to whatever. InfoWriteHeader just prints to whatever too I set strComputer = "." Private Sub ListSoundDeviceProperties(Optional strComputer As String = csDot) Dim objWMIService, colItems Dim objItem Dim lIndex As Long On Error GoTo ListSoundDevicePropertiesErr Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_SoundDevice", , 48) InfoWriteHeader "ListSoundDeviceProperties" For Each objItem In colItems If bStopCheck Then Exit For lIndex = lIndex + 1 InfoWrite "Item " & lIndex InfoWrite "Availability: " & objItem.Availability InfoWrite "Caption: " & objItem.Caption InfoWrite "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode InfoWrite "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig InfoWrite "CreationClassName: " & objItem.CreationClassName InfoWrite "Description: " & objItem.Description InfoWrite "DeviceID: " & objItem.DeviceID InfoWrite "DMABufferSize: " & objItem.DMABufferSize InfoWrite "ErrorCleared: " & objItem.ErrorCleared InfoWrite "ErrorDescription: " & objItem.errorDescription InfoWrite "InstallDate: " & objItem.InstallDate InfoWrite "LastErrorCode: " & objItem.LastErrorCode InfoWrite "Manufacturer: " & objItem.Manufacturer InfoWrite "MPU401Address: " & objItem.MPU401Address InfoWrite "Name: " & objItem.Name InfoWrite "PNPDeviceID: " & objItem.PNPDeviceID InfoWrite "PowerManagementCapabilities: " & objItem.PowerManagementCapabilities InfoWrite "PowerManagementSupported: " & objItem.PowerManagementSupported InfoWrite "ProductName: " & objItem.ProductName InfoWrite "Status: " & objItem.Status InfoWrite "StatusInfo: " & objItem.StatusInfo InfoWrite "SystemCreationClassName: " & objItem.SystemCreationClassName InfoWrite "SystemName: " & objItem.SystemName InfoWrite Next InfoWrite ListSoundDevicePropertiesExit: Exit Sub ListSoundDevicePropertiesErr: Debug.Assert False Resume Next End Sub 'ListSoundDeviceProperties Show quoteHide quote "mickey" wrote: > Hi All > I am attempting to create a record and play project that uses mci to record > and play audio files. > I would like to present the user a list of all mci compatible audio devices > on the computer. I have been researching this on the web for days with no > concrete results. > Can anyone make a suggestion please. > > Thanks > Mickey > Bee
I copied you code into a small test program I had been working with. I ran it and I got some huge debug message. I tried to step through it and it just bombed at the for loop so I don't really understand. However, I was playing around with ManagementClass and you gave me what I was missing . . . "Win32_SoundDevice". Thanks P.S. I want to study your solution to understand why it works for you and not for me. Thanks again for the help Mickey Show quoteHide quote "Bee" <B**@discussions.microsoft.com> wrote in message news:C4820AE1-6983-4349-A219-F02AB1F3BDEC@microsoft.com... >I am not sure how much help this will be, but you can get a list of audio > devices from SAPI. Also, as follows > InfoWrite is just a print to whatever. > InfoWriteHeader just prints to whatever too > I set strComputer = "." > > Private Sub ListSoundDeviceProperties(Optional strComputer As String = > csDot) > > Dim objWMIService, colItems > Dim objItem > Dim lIndex As Long > > On Error GoTo ListSoundDevicePropertiesErr > > Set objWMIService = GetObject("winmgmts:\\" & strComputer & > "\root\cimv2") > Set colItems = objWMIService.ExecQuery("Select * from > Win32_SoundDevice", , 48) > > InfoWriteHeader "ListSoundDeviceProperties" > > For Each objItem In colItems > If bStopCheck Then Exit For > lIndex = lIndex + 1 > InfoWrite "Item " & lIndex > InfoWrite "Availability: " & objItem.Availability > InfoWrite "Caption: " & objItem.Caption > InfoWrite "ConfigManagerErrorCode: " & > objItem.ConfigManagerErrorCode > InfoWrite "ConfigManagerUserConfig: " & > objItem.ConfigManagerUserConfig > InfoWrite "CreationClassName: " & objItem.CreationClassName > InfoWrite "Description: " & objItem.Description > InfoWrite "DeviceID: " & objItem.DeviceID > InfoWrite "DMABufferSize: " & objItem.DMABufferSize > InfoWrite "ErrorCleared: " & objItem.ErrorCleared > InfoWrite "ErrorDescription: " & objItem.errorDescription > InfoWrite "InstallDate: " & objItem.InstallDate > InfoWrite "LastErrorCode: " & objItem.LastErrorCode > InfoWrite "Manufacturer: " & objItem.Manufacturer > InfoWrite "MPU401Address: " & objItem.MPU401Address > InfoWrite "Name: " & objItem.Name > InfoWrite "PNPDeviceID: " & objItem.PNPDeviceID > InfoWrite "PowerManagementCapabilities: " & > objItem.PowerManagementCapabilities > InfoWrite "PowerManagementSupported: " & > objItem.PowerManagementSupported > InfoWrite "ProductName: " & objItem.ProductName > InfoWrite "Status: " & objItem.Status > InfoWrite "StatusInfo: " & objItem.StatusInfo > InfoWrite "SystemCreationClassName: " & > objItem.SystemCreationClassName > InfoWrite "SystemName: " & objItem.SystemName > InfoWrite > Next > InfoWrite > > ListSoundDevicePropertiesExit: > Exit Sub > > ListSoundDevicePropertiesErr: > Debug.Assert False > Resume Next > > End Sub 'ListSoundDeviceProperties > > > > "mickey" wrote: > >> Hi All >> I am attempting to create a record and play project that uses mci to >> record >> and play audio files. >> I would like to present the user a list of all mci compatible audio >> devices >> on the computer. I have been researching this on the web for days with >> no >> concrete results. >> Can anyone make a suggestion please. >> >> Thanks >> Mickey >> Sorry, I forgot to mention that you need to menu to Project/References
and check Microsoft WMI Scripting Vxx Library. Show quoteHide quote "mickey" wrote: > Bee > I copied you code into a small test program I had been working with. > I ran it and I got some huge debug message. I tried to step through it and > it just bombed at the for loop so I don't really understand. > However, I was playing around with ManagementClass and you gave me what I > was missing . . . "Win32_SoundDevice". > Thanks > > P.S. I want to study your solution to understand why it works for you and > not for me. > > Thanks again for the help > > Mickey > > > "Bee" <B**@discussions.microsoft.com> wrote in message > news:C4820AE1-6983-4349-A219-F02AB1F3BDEC@microsoft.com... > >I am not sure how much help this will be, but you can get a list of audio > > devices from SAPI. Also, as follows > > InfoWrite is just a print to whatever. > > InfoWriteHeader just prints to whatever too > > I set strComputer = "." > > > > Private Sub ListSoundDeviceProperties(Optional strComputer As String = > > csDot) > > > > Dim objWMIService, colItems > > Dim objItem > > Dim lIndex As Long > > > > On Error GoTo ListSoundDevicePropertiesErr > > > > Set objWMIService = GetObject("winmgmts:\\" & strComputer & > > "\root\cimv2") > > Set colItems = objWMIService.ExecQuery("Select * from > > Win32_SoundDevice", , 48) > > > > InfoWriteHeader "ListSoundDeviceProperties" > > > > For Each objItem In colItems > > If bStopCheck Then Exit For > > lIndex = lIndex + 1 > > InfoWrite "Item " & lIndex > > InfoWrite "Availability: " & objItem.Availability > > InfoWrite "Caption: " & objItem.Caption > > InfoWrite "ConfigManagerErrorCode: " & > > objItem.ConfigManagerErrorCode > > InfoWrite "ConfigManagerUserConfig: " & > > objItem.ConfigManagerUserConfig > > InfoWrite "CreationClassName: " & objItem.CreationClassName > > InfoWrite "Description: " & objItem.Description > > InfoWrite "DeviceID: " & objItem.DeviceID > > InfoWrite "DMABufferSize: " & objItem.DMABufferSize > > InfoWrite "ErrorCleared: " & objItem.ErrorCleared > > InfoWrite "ErrorDescription: " & objItem.errorDescription > > InfoWrite "InstallDate: " & objItem.InstallDate > > InfoWrite "LastErrorCode: " & objItem.LastErrorCode > > InfoWrite "Manufacturer: " & objItem.Manufacturer > > InfoWrite "MPU401Address: " & objItem.MPU401Address > > InfoWrite "Name: " & objItem.Name > > InfoWrite "PNPDeviceID: " & objItem.PNPDeviceID > > InfoWrite "PowerManagementCapabilities: " & > > objItem.PowerManagementCapabilities > > InfoWrite "PowerManagementSupported: " & > > objItem.PowerManagementSupported > > InfoWrite "ProductName: " & objItem.ProductName > > InfoWrite "Status: " & objItem.Status > > InfoWrite "StatusInfo: " & objItem.StatusInfo > > InfoWrite "SystemCreationClassName: " & > > objItem.SystemCreationClassName > > InfoWrite "SystemName: " & objItem.SystemName > > InfoWrite > > Next > > InfoWrite > > > > ListSoundDevicePropertiesExit: > > Exit Sub > > > > ListSoundDevicePropertiesErr: > > Debug.Assert False > > Resume Next > > > > End Sub 'ListSoundDeviceProperties > > > > > > > > "mickey" wrote: > > > >> Hi All > >> I am attempting to create a record and play project that uses mci to > >> record > >> and play audio files. > >> I would like to present the user a list of all mci compatible audio > >> devices > >> on the computer. I have been researching this on the web for days with > >> no > >> concrete results. > >> Can anyone make a suggestion please. > >> > >> Thanks > >> Mickey > >> > never would have figured it out though it did look like scripting
Thanks again Show quoteHide quote "Bee" <B**@discussions.microsoft.com> wrote in message news:18CEC452-B7B2-49D3-963C-6CF9746C249B@microsoft.com... > Sorry, I forgot to mention that you need to menu to Project/References > and check > > Microsoft WMI Scripting Vxx Library. > > "mickey" wrote: > >> Bee >> I copied you code into a small test program I had been working with. >> I ran it and I got some huge debug message. I tried to step through it >> and >> it just bombed at the for loop so I don't really understand. >> However, I was playing around with ManagementClass and you gave me what I >> was missing . . . "Win32_SoundDevice". >> Thanks >> >> P.S. I want to study your solution to understand why it works for you and >> not for me. >> >> Thanks again for the help >> >> Mickey >> >> >> "Bee" <B**@discussions.microsoft.com> wrote in message >> news:C4820AE1-6983-4349-A219-F02AB1F3BDEC@microsoft.com... >> >I am not sure how much help this will be, but you can get a list of >> >audio >> > devices from SAPI. Also, as follows >> > InfoWrite is just a print to whatever. >> > InfoWriteHeader just prints to whatever too >> > I set strComputer = "." >> > >> > Private Sub ListSoundDeviceProperties(Optional strComputer As String = >> > csDot) >> > >> > Dim objWMIService, colItems >> > Dim objItem >> > Dim lIndex As Long >> > >> > On Error GoTo ListSoundDevicePropertiesErr >> > >> > Set objWMIService = GetObject("winmgmts:\\" & strComputer & >> > "\root\cimv2") >> > Set colItems = objWMIService.ExecQuery("Select * from >> > Win32_SoundDevice", , 48) >> > >> > InfoWriteHeader "ListSoundDeviceProperties" >> > >> > For Each objItem In colItems >> > If bStopCheck Then Exit For >> > lIndex = lIndex + 1 >> > InfoWrite "Item " & lIndex >> > InfoWrite "Availability: " & objItem.Availability >> > InfoWrite "Caption: " & objItem.Caption >> > InfoWrite "ConfigManagerErrorCode: " & >> > objItem.ConfigManagerErrorCode >> > InfoWrite "ConfigManagerUserConfig: " & >> > objItem.ConfigManagerUserConfig >> > InfoWrite "CreationClassName: " & objItem.CreationClassName >> > InfoWrite "Description: " & objItem.Description >> > InfoWrite "DeviceID: " & objItem.DeviceID >> > InfoWrite "DMABufferSize: " & objItem.DMABufferSize >> > InfoWrite "ErrorCleared: " & objItem.ErrorCleared >> > InfoWrite "ErrorDescription: " & objItem.errorDescription >> > InfoWrite "InstallDate: " & objItem.InstallDate >> > InfoWrite "LastErrorCode: " & objItem.LastErrorCode >> > InfoWrite "Manufacturer: " & objItem.Manufacturer >> > InfoWrite "MPU401Address: " & objItem.MPU401Address >> > InfoWrite "Name: " & objItem.Name >> > InfoWrite "PNPDeviceID: " & objItem.PNPDeviceID >> > InfoWrite "PowerManagementCapabilities: " & >> > objItem.PowerManagementCapabilities >> > InfoWrite "PowerManagementSupported: " & >> > objItem.PowerManagementSupported >> > InfoWrite "ProductName: " & objItem.ProductName >> > InfoWrite "Status: " & objItem.Status >> > InfoWrite "StatusInfo: " & objItem.StatusInfo >> > InfoWrite "SystemCreationClassName: " & >> > objItem.SystemCreationClassName >> > InfoWrite "SystemName: " & objItem.SystemName >> > InfoWrite >> > Next >> > InfoWrite >> > >> > ListSoundDevicePropertiesExit: >> > Exit Sub >> > >> > ListSoundDevicePropertiesErr: >> > Debug.Assert False >> > Resume Next >> > >> > End Sub 'ListSoundDeviceProperties >> > >> > >> > >> > "mickey" wrote: >> > >> >> Hi All >> >> I am attempting to create a record and play project that uses mci to >> >> record >> >> and play audio files. >> >> I would like to present the user a list of all mci compatible audio >> >> devices >> >> on the computer. I have been researching this on the web for days >> >> with >> >> no >> >> concrete results. >> >> Can anyone make a suggestion please. >> >> >> >> Thanks >> >> Mickey >> >> >>
VB6 on Vista Home Premium problem
Excel Execution from VB Fails on 2nd Attempt Use an Addin to automatically add date/time stamp to each edited line of VB6 code? Sub .... or Private Sub.... When and where do I do Set m_FormVar = Nothing? Moving .exe somtimes works In High Density Mode - Looking for previous control counting post How to create the project referencing library, which user may not have on his computer? MS Access Query in VB6 fso.Drives replacement |
|||||||||||||||||||||||