日期:2014-05-17  浏览次数:20841 次

C#怎么控制系统音量??
要兼容xp 2000 2003 vista win7 win8 win2008 win2008r2
用sendmessage这个是可以调高调低音量  但是很不方便


DllImport("winmm.dll")]
public static extern long waveOutSetVolume(UInt32 deviceID, UInt32 Volume);
[DllImport("winmm.dll")]
public static extern long waveOutGetVolume(UInt32 deviceID, out UInt32 Volume);

用这两个条是可以调和获取到值  但是声音没变化 值也不是系统音量的 等于没用

求高手  本人环境win8 64

------解决方案--------------------
这里有段代码,看起来很复杂,lz自己看看吧
Change master audio volume from XP to Windows 8 in C#
http://stackoverflow.com/questions/15250379/change-master-audio-volume-from-xp-to-windows-8-in-c-sharp