0

I would like to mute sound in Windows, or stop/play music using multimedia keys, so I writed:

QTest::keyClick(QApplication::focusWidget(), Qt::Key_VolumeMute , Qt::NoModifier);

But nothing happens, is there any way to do this?

  • Qt can only post events to Qt, not to the system. You will need to use the system APIs. – dtech Jan 23 '17 at 12:12
  • Where do you need to mute sound? In your or another program? – Ilya Jan 23 '17 at 12:13
  • @Ilya Entire System, Windows, thats why I tried to programmatically press mute button. –  Jan 23 '17 at 12:16
  • @ddriver yes, but there is no chance to press for example play button programmatically and it will affect in entire system? –  Jan 23 '17 at 12:17
  • https://msdn.microsoft.com/en-us/library/ms646310(v=vs.85).aspx – dtech Jan 23 '17 at 12:19
  • @S.llous No, QTest will not do it. It seems you need to read this: https://blogs.msdn.microsoft.com/matthew_van_eerde/2011/04/22/windows-audio-render-volume-settings-from-local-to-global/ http://stackoverflow.com/questions/699603/change-volume-win32-c http://stackoverflow.com/questions/294292/changing-master-volume-level/ http://stackoverflow.com/questions/255419/how-can-i-mute-unmute-my-sound-from-powershell – Ilya Jan 23 '17 at 12:19

0 Answers0