winform程序静音

using System.Runtime.InteropServices;    //命名空间

const uint WM_APPCOMMAND = 0x319;
const uint APPCOMMAND_VOLUME_UP = 0x0a;
const uint APPCOMMAND_VOLUME_DOWN = 0x09;
const uint APPCOMMAND_VOLUME_MUTE = 0x08;

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, uint wParam, uint lParam);

 

 

private void music_Click(object sender, EventArgs e)
{
SendMessage(this.Handle, WM_APPCOMMAND, 0x200eb0, APPCOMMAND_VOLUME_MUTE * 0x10000);
}

winform程序静音,布布扣,bubuko.com

winform程序静音

上一篇:Windows内核


下一篇:在Windows XP下整合Apache+Tomcat+PHP