change volume win32 c++

后端 未结 6 1974
你的背包
你的背包 2020-12-09 05:41

How would I go about changing the sound volume in c++ win32? Also how would I mute/unmute it? Thanks for the help!

6条回答
  •  再見小時候
    2020-12-09 06:33

    Use the waveOutSetVolume API.

    Here's an example:

      DWORD dwVolume;
    
      if (waveOutGetVolume(NULL, &dwVolume) == MMSYSERR_NOERROR)
        waveOutSetVolume(NULL, 0); // mute volume
    
      // later point in code, to unmute volume...
      waveOutSetVolume(NULL, dwVolume);
    

提交回复
热议问题