C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
7,625 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I created an audio recorder in c# but I want it to display a messagebox if there is no audio input / audio output just like Windows 10 Voice Recorder. How am I supposed to do that.? Also how can I list out all the list of devices connected to the system in a listbox?
With Core Audio APIs, like in the sample I posted in this thread Detect Audio on Windows 10
(you can change EDataFlow)
or another more advanced sample : Core Audio APIs test
In the second one, I enumerate in a ListView all audio devices :
Ok thanks, your code works great! but how do I display a message box specifically if there is no audio device at all?
You could just count them with pDeviceCollection.GetCount
(either with EDataFlow.eAll or EDataFlow.eRender or EDataFlow.eCapture)
(I used DEVICE_STATE_ACTIVE | DEVICE_STATE_UNPLUGGED | DEVICE_STATE_DISABLED to list them all, you could just use DEVICE_STATE_ACTIVE)
Ok thnx so much! It works. Can you help me with this one also:
https://learn.microsoft.com/en-us/answers/questions/478412/saving-listbox-data-with-file-paths-c.html
Sign in to comment