SoFunction
Updated on 2025-03-07

C# implements the method of controlling the volume and mute system based on the addition and subtraction buttons

C# implements the method of controlling the volume and mute system based on the addition and subtraction buttons

Updated: October 9, 2015 12:26:09 Author: Little Editor
This article mainly introduces C# to control the volume and mute system based on the addition and subtraction button form, and involves the relevant skills of C# to reference the operating system volume of the dynamic link library. It has certain reference value. Friends who need it can refer to it.

This article describes the method of C# to control the volume and mute system based on the addition and subtraction button form. Share it for your reference. The details are as follows:

using System; 
using ; 
using ; 
using ; 
using ; 
using ; 
using ; 
using ; 
namespace VolumnSet 
{ 
  public partial class Form1 : Form 
  { 
    [DllImport("", CharSet = , SetLastError = true)] 
    static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, uint wParam, uint lParam); 
    const uint WM_APPCOMMAND = 0x319; 
    const uint APPCOMMAND_VOLUME_UP = 0x0a; 
    const uint APPCOMMAND_VOLUME_DOWN = 0x09; 
    const uint APPCOMMAND_VOLUME_MUTE = 0x08; 
    public Form1() 
    { 
      InitializeComponent(); 
    } 
    private void button1_Click(object sender, EventArgs e) 
    { 
      //Add volume      SendMessage(, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_UP * 0x10000); 
    } 
    private void button2_Click(object sender, EventArgs e) 
    { 
      //Reduce the volume      SendMessage(, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_DOWN * 0x10000); 
    } 
    private void checkBox1_CheckedChanged(object sender, EventArgs e) 
    { 
      //Mute      SendMessage(, WM_APPCOMMAND, 0x200eb0, APPCOMMAND_VOLUME_MUTE * 0x10000); 
    } 
  } 
}

I hope this article will be helpful to everyone's C# programming.

  • C#
  • volume

Related Articles

  • Detailed explanation of serial port communication based on C#

    This article mainly introduces C# to implement serial port communication based on SerialPort class. The sample code in the article is introduced in detail and has a certain reference value. Interested friends can refer to it.
    2022-01-01
  • C# Static Constructor Usage Example Analysis

    This article mainly introduces the usage of C# static constructors, and analyzes the uses, implementation methods and usage techniques of C# static constructors in more detail in the form of examples. Friends who need it can refer to it.
    2015-06-06
  • C# Example of calling Tencent Instant Communication IM

    This article mainly introduces examples of C# calling Tencent instant messaging IM to help everyone better understand and use C#. Interested friends can learn about it.
    2020-11-11
  • Implementation method of comboBox control data binding in WinForm

    This article mainly introduces the implementation method of comboBox control data binding in WinForm, and analyzes the common methods and related operation techniques for WinForm to implement comboBox control data binding in WinForm. Friends who need it can refer to it
    2017-05-05
  • UnityShader3 realizes rotation and cooling effects

    This article mainly introduces the effect of UnityShader3 to realize the rotation and cooling effect. The sample code in the article is introduced in detail and has a certain reference value. Interested friends can refer to it.
    2019-03-03
  • C# generates pie chart and adds text description example code

    This article mainly introduces C#'s method of generating pie charts and adding text descriptions. It is very practical. Friends who need it can refer to it.
    2014-07-07
  • C# Use Dictionary to copy cloned copies and compare whether they are equal

    This article mainly introduces C# using Dictionary to copy cloned copies and compare whether they are equal. It has good reference value and hopes it will be helpful to everyone. Let's take a look with the editor
    2020-12-12
  • C# Get the value code of gridview

    This article mainly introduces how C# can obtain the value of TextBox in GridView in events. Please refer to it.
    2013-12-12
  • Answers to the memory layout of C# Struct

    This article introduces the answers to the memory layout of C# Struct. Friends who need it can refer to it
    2013-11-11
  • C# implements the MojoUnityJson function of JSON parser (simple and efficient)

    MojoUnityJson is a JSON parser implemented using C#. The algorithm idea comes from the C language implementation of the game engine Mojoc. This article mainly introduces the method of implementing the JSON parser MojoUnityJson in C#. Friends who need it can refer to it
    2018-01-01

Latest Comments