问题
I am making a program and I want to find and mute programs that are playing audio so all you hear is mine.
(This is an option for the program, nothing malicious about it)
I have looked it up and I cannot seem to find a way to check what programs are playing audio (Much like windows does)
I don't have any code examples of attempting this because id has no idea.
In case someone misses reads or I don't word the above sentences correct I would like to find EVERY process with audio playing and either KILL or MUTE the process
回答1:
If you can get Peak meters for individual programs on Windows 7, you can identify sessions and applications. IAudioSessionControl
interface offers you muting options similar to what user can do via standard Volume Mixer application (session muting in particular).
回答2:
There was a pretty similar question, maybe the same approach I posted in my answer would fit your scenario: https://stackoverflow.com/a/14828598/674700. What you'd need to change are the types of files (into .mp3
, .wav
and so on) and kill the processes found, with the exception of your application's.
The drawbacks: you'll need to run your application as administrator and it also requires a third party console app.
来源:https://stackoverflow.com/questions/14850951/check-what-programs-are-playing-audio