0

I want to create an UWP app which should pause the all the sound of my Windows system when there is call is connected in the Google meet, Zoom etc.

How to do this by using C#.

Rand Random
  • 7,300
  • 10
  • 40
  • 88
Smit Rathod
  • 101
  • 6

1 Answers1

1

Just from UWP side, UWP apps are running in sandbox which are isolated from system, it cannot access other app's process and is restricted when accessing system resources. So, you can't pause Windows system sound from UWP.

But there is a solution, you can use Desktop-bridge to start a desktop application, call Win32 API keybd_event with VK_MEDIA_PLAY_PAUS to simulate pause key input. You can refer to Stefan Wick's blog UWP with Desktop Extension – Part 2

Junjie Zhu - MSFT
  • 2,086
  • 1
  • 2
  • 6
  • Can I achieve it by using WPF? – Smit Rathod Jun 16 '23 at 06:15
  • In WPF, you can refer to [this](https://stackoverflow.com/questions/7199203/send-key-mediaplaypause-to-an-application-without-setting-focus-to-it?answertab=modifieddesc#tab-top), use the Win32 API `keybd_event` directly, no need for Desktop-bridge. – Junjie Zhu - MSFT Jun 16 '23 at 06:22