亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#實(shí)現(xiàn)基于加減按鈕形式控制系統(tǒng)音量及靜音的方法

 更新時(shí)間:2015年10月09日 12:26:09   作者:小編輯  
這篇文章主要介紹了C#實(shí)現(xiàn)基于加減按鈕形式控制系統(tǒng)音量及靜音的方法,涉及C#引用user32.dll動(dòng)態(tài)鏈接庫(kù)操作系統(tǒng)音量的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了C#實(shí)現(xiàn)基于加減按鈕形式控制系統(tǒng)音量及靜音的方法。分享給大家供大家參考。具體如下:

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using System.Runtime.InteropServices; 
namespace VolumnSet 
{ 
  public partial class Form1 : Form 
  { 
    [DllImport("user32.dll", CharSet = CharSet.Auto, 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) 
    { 
      //加音量 
      SendMessage(this.Handle, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_UP * 0x10000); 
    } 
    private void button2_Click(object sender, EventArgs e) 
    { 
      //減音量 
      SendMessage(this.Handle, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_DOWN * 0x10000); 
    } 
    private void checkBox1_CheckedChanged(object sender, EventArgs e) 
    { 
      //靜音 
      SendMessage(this.Handle, WM_APPCOMMAND, 0x200eb0, APPCOMMAND_VOLUME_MUTE * 0x10000); 
    } 
  } 
}

希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論