locked
Wish to select Speaker/Headphone (Realtek High Definition Audio) by default without using ComboBox RRS feed

  • Question

  • User-2115944482 posted

    s it possible to select Speaker/Headphone (Realtek High Definition Audio)

    var enumerator = new MMDeviceEnumerator();
        foreach (var wasapi in enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.All))
               {
                    {wasapi.DeviceFriendlyName} {wasapi.State}
                  MessageBox.Show($" {wasapi.FriendlyName}");
                   if (wasapi.FriendlyName.Contains("speaker"))
                   {
                       device = ????????????????
                    }
              }

    Regards dwk

    Friday, December 13, 2019 1:51 PM

All replies

  • User753101303 posted

    Hi,

    Try rather https://social.msdn.microsoft.com/Forums/en-US/home or StackOverflow for a Windows development forum (ASP.NET is the part that deals with web based application). You don't have the doc for this API ? This is the "Windows Vista API Pack" that MS made available a long time ago to expose most Windows API to .NET app ?

    If you are working on a web app it will just never work (it may seem to work when developping on your own machine but keep in mind that once deployed on a real web server ylour C# code runs on the web server side, NOT on the browser client side).

    Friday, December 13, 2019 2:05 PM