Mute Windows Volume using C#

后端 未结 7 1309
广开言路
广开言路 2020-11-30 05:01

Anyone know how to programmatically mute the Windows XP Volume using C#?

相关标签:
7条回答
  • 2020-11-30 05:53

    See How to programmatically mute the Windows XP Volume using C#?

    void SetPlayerMute(int playerMixerNo, bool value)
    {
        Mixer mx = new Mixer();
        mx.MixerNo = playerMixerNo;
        DestinationLine dl = mx.GetDestination(Mixer.Playback);
        if (dl != null)
        {
            foreach (MixerControl ctrl in dl.Controls)
            {
                if (ctrl is MixerMuteControl)
                {
                    ((MixerMuteControl)ctrl).Value = (value) ? 1 : 0;
                    break;
                }
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题