英文:
How To Pause All The Sounds Of The System When The Call Is Connected
问题
我想创建一个UWP应用程序,当在Google Meet、Zoom等应用中接通电话时,应该暂停Windows系统的所有声音。
如何使用C#来实现这个功能。
英文:
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#.
答案1
得分: 1
从 UWP 方面来看,UWP 应用程序在沙盒中运行,与系统隔离,无法访问其他应用程序的进程,在访问系统资源时受到限制。因此,您无法通过 UWP 暂停 Windows 系统声音。
但有一个解决方案,您可以使用桌面桥启动桌面应用程序,调用 Win32 API keybd_event,使用 VK_MEDIA_PLAY_PAUSE
模拟暂停键输入。您可以参考 Stefan Wick 的博客 UWP with Desktop Extension – Part 2。
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论