64 位操作系统上的 .Net WinForm 系统蜂鸣声

发布于 2024-08-06 05:17:07 字数 376 浏览 3 评论 0原文

当验证失败时,我的应用程序需要发出蜂鸣声,以便用户(可能在几英尺外)可以听到它。我想使用 Console.Beep() 但这是 在 x64 环境中不可用(请参阅备注)。计算机中可能有也可能没有扬声器,因此我无法使用 System.Media.SystemSounds.Beep.Play()

当前的目标平台是 x86 环境,但我希望应用程序也能够在 x64 中运行。

有办法做到这一点还是我应该放弃?

编辑:添加了该方法的链接。

My application needs to beep when validation fails so the user (who may be several feet away) may hear it. I'd like to use the Console.Beep() but this is unavailable in a x64 environment (see the remarks). There may or may not be speakers in/at the computer, so I can't use System.Media.SystemSounds.Beep.Play().

The current target platform is a x86 environment, but I'd like to have the ability for the application to run in x64 also.

Is there a way to do this or should I just give up?

Edit: Added link to the method.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

极致的悲 2024-08-13 05:17:07

Beep 已作为本机功能删除所有 x64 平台(当然没有托管版本),存在 Microsoft Connect 问题,请求退回它。

我们使用不同的技巧来发现服务器,我们远程弹出 DVD 驱动器,托盘打开的驱动器就是我们要寻找的驱动器:)

[编辑]
Larry Osterman 有一篇关于此的精彩文章:Windows 7 中的蜂鸣驱动程序是怎么回事

Beep has been removed as a native function from all x64 platforms (so no managed version of course), there was a Microsoft Connect issue that petitioned to return it.

We use a different trick to discover servers, we remote eject the dvd drive, and the drive with the tray open is the one were looking for :)

[EDIT]
Larry Osterman has a great article about this: What's up with the beep driver in Windows 7

破晓 2024-08-13 05:17:07

播放标准窗口声音之一可能是更好的方法。下面的文章展示了如何操作(只需要几行):

http://msdn.microsoft.com/en-us/library/4y171b18(VS.100).aspx

如果您想留在主题内,您可以检查 Windows 注册表中当前的声音方案,然后播放适当的声音以满足您的需要。

Playing one of the standard windows sounds might be a better approach. The following article shows how (it only takes a couple lines):

http://msdn.microsoft.com/en-us/library/4y171b18(VS.100).aspx

If you wanted to stay within theme, you could check the windows registry for the current sound scheme, and play the appropriate sound to fit your need.

凉城已无爱 2024-08-13 05:17:07

您可以使用此处描述的 Console.Beep() 方法:https://msdn.microsoft.com/en-us/library/8hftfeyw(v=vs.110).aspx

确保以管理员身份运行可执行文件(已升级特权)

You can use the Console.Beep() method described here: https://msdn.microsoft.com/en-us/library/8hftfeyw(v=vs.110).aspx

Make sure that you run the executable as an administrator (escalated privileges)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文