Visual Studio:如何在遇到断点时触发警报?
当我的断点被击中时,有没有办法触发蜂鸣声/警报/声音? 我正在使用 Visual Studio 2005/2008。
Is there a way to trigger a beep/alarm/sound when my breakpoint is hit? I'm using Visual Studio 2005/2008.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以创建一个宏来响应断点触发而运行。 在宏中,您可以采取任何措施来发出蜂鸣声。
You can create a macro that runs in response to a breakpoint firing. In your macro, you could do whatever it takes to make a beeping noise.
Windows XP
控制面板 -> 声音和音频... -> 程序事件 - Microsoft Developer -> 断点命中
Windows 7
控制面板 -> 所有控制面板项目 -> 声音 -> 声音(选项卡)- Microsoft Visual Studio -> 断点命中
Windows XP
Control Panel -> Sounds and Audio... -> Program Events - Microsoft Developer -> Breakpoint Hit
Windows 7
Control Panel -> All Control Panel Items -> Sounds -> Sounds (tab) - Microsoft Visual Studio -> Breakpoint Hit
是的,您可以使用分配给断点的宏来完成此操作。 这在 VS 2005 中有效,我认为 2008 也能工作。 我假设您不希望每个断点都发出声音,否则其他答案就可以正常工作。 可能有一种方法可以播放特定的声音,但我没有深入挖掘。 以下是基本步骤:
添加新的宏模块(代码下方的步骤)
分配到断点
另外,还有一些方法可以播放任意 wav 文件,但这对于警报来说似乎太过分了。 也许强制的“嘟嘟”声是最好的,因为这至少听起来与 Ding 不同。
Yes, you can do it with a Macro assigned to a breakpoint. This works in VS 2005, I assume 2008 will work as well. I assume you don't want a sound on EVERY breakpoint, or the other answer will work fine. There is probably a way to play a specific sound, but I didn't dig that hard. Here are the basic steps:
Add A New Macro Module (steps below the code)
Assign To A Breakpoint
Also, there are ways to play an arbitrary wav file, but that seems excessive for an alert. Perhaps the forced "beep" is the best, since that at least sounds different than Ding.