显示当前的卷状态 [英] Show current volume status
问题描述
我需要显示计算机的音量状态。
我创建了两张图片来显示音量是否静音。
我发现这段代码但是我得到错误:
I need to show the volume status of the computer.
I created two pictures to show if the volume is muted or not.
I found this code but I get errors:
MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
defaultDevice.AudioEndpointVolume.Mute = true;
所以这里我会说一个条件说如果它是真的显示静音图片等等
但它不承认
像[这里]
我的尝试:
我尝试了这段代码,但它显示了一些错误。
我在一些论坛上看到我必须把这个:
使用CoreAudioApi;
但它也显示错误。
So here I will put a condition to say that if it is true show the mute picture and so on
but it doesn't recognize
like [here]
What I have tried:
I tried this code but it shows some errors.
I saw in some forums that I must put this:
using CoreAudioApi;
But also it shows errors.
推荐答案
您是否已将CoreAudioAPI.dll
下载到您的磁盘呢?
如果是这样,那么你必须在项目中引用CoreAudioAPI.dll。
转到你的项目属性 - 参考 - 添加 - 浏览 - 本地化DLL。
在您的表格上添加导入声明
Have you downloaded theCoreAudioAPI.dll
to your disk yet?
If so then you must make a reference to the CoreAudioAPI.dll on your project.
Go to your Project Properties - References - Add - Browse - Localize the DLL.
On your Form, add an import statement
using CoreAudioAPI;
我在不久前用R.Molenkamp编写的CoreAudioAPI帮助在VB.NET中创建了一个VUMeter应用程序。
以下是我在YouTube.com上观看视频的链接
VB.NET - VU Meter(不支持win-xp) - YouTube [ ^ ]
请注意,Windows XP不支持CoreAudioAPI。
如果是帮助,请接受此解决方案并投票,谢谢。
I have created some time ago a VUMeter application in VB.NET with the help of CoreAudioAPI which is written by R.Molenkamp.
Here is the link to my video on YouTube.com
VB.NET - VU Meter (win-xp not supported) - YouTube[^]
Be aware that CoreAudioAPI is not supported on Windows XP.
If it helped, please accept this solution and vote it, thanks.
这篇关于显示当前的卷状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!