日期:2014-05-17 浏览次数:20813 次
//导入API
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
//需要的时候调用,相当按键盘上的声音+/-快捷键
keybd_event((byte)System.Windows.Forms.Keys.VolumeUp, 0, 0, 0);//+
keybd_event((byte)System.Windows.Forms.Keys.VolumeDown, 0, 0, 0);//-
keybd_event((byte)System.Windows.Forms.Keys.VolumeMute, 0, 0, 0);//静音