静音/取消静音应用程序声音 [英] Mute/Unmute Application Sounds

查看:64
本文介绍了静音/取消静音应用程序声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用的代码是:

My.Computer.Audio.Play(My.Resources.audio_here, AudioPlayMode.Background)

推荐答案

查看 winmm.dll 中的 waveOutSetVolumewaveOutGetVolume 函数

Take a look at the waveOutSetVolume and waveOutGetVolume functions in winmm.dll

Private Declare Function waveOutSetVolume Lib "winmm.dll" (ByVal uDeviceID As Integer, ByVal dwVolume As Integer) As Integer
Private Declare Function waveOutGetVolume Lib "winmm.dll" (ByVal uDeviceID As Integer, ByRef lpdwVolume As Integer) As Integer

waveOutSetVolume 函数

waveOutGetVolume 函数

根据目标机器的操作系统版本,您可能需要考虑使用较新的 MMDeviceEndpointVolume API.

Depending on the OS version of your target machines, you may need to look into using the newer MMDevice and EndpointVolume APIs.

EndpointVolume 示例代码

这篇关于静音/取消静音应用程序声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆