用三行代码实现对音量的控制,实现增大,减小,静音,哈哈
增大音量:
keybd_event(VK_VOLUME_UP,MapVirtualKey(VK_VOLUME_UP,0),KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VK_VOLUME_UP,MapVirtualKey(VK_VOLUME_UP,0),KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);
减小音量:
keybd_event(VK_VOLUME_DOWN,MapVirtualKey(VK_VOLUME_DOWN,0),KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VK_VOLUME_DOWN,MapVirtualKey(VK_VOLUME_DOWN,0),KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);
静音:
keybd_event(VK_VOLUME_MUTE,MapVirtualKey(VK_VOLUME_MUTE,0),KEYEVENTF_EXTENDEDKEY,0);
keybd_event(VK_VOLUME_MUTE,MapVirtualKey(VK_VOLUME_MUTE,0),KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);