迷一样的逍遥人
晴带雨伞,包带干粮,点滴积累,水到渠成.
public partial class AdjustVolume
    {
        [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  static void PlusVolume(IntPtr hWnd)
        {
            //增加音量
            SendMessage(hWnd, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_UP * 0x10000);
        }
      public static void MinusVolume(IntPtr hWnd)
        {
            //减少音量
            SendMessage(hWnd, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_DOWN * 0x10000);
        }
      public static void MuteSwitch(IntPtr hWnd)
        {
            //静音切换
            SendMessage(hWnd, WM_APPCOMMAND, 0x200eb0, APPCOMMAND_VOLUME_MUTE * 0x10000);
        }
    }

 

posted on 2013-02-23 22:58  谜一样的逍遥人  阅读(419)  评论(0编辑  收藏  举报