如何发出 Windows 服务蜂鸣声? [英] how can I make a Windows service beep?

查看:86
本文介绍了如何发出 Windows 服务蜂鸣声?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一项服务,可以充当多个应用程序/服务器的看门狗.这台机器上没有用户会话.如果出现问题,我希望看门狗能够在内部扬声器上发出哔哔声(这是我的队列去解决它抱怨的任何问题)

I've got a service that acts as a watchdog for several apps/servers. There are no user sessions on this machine. I'd like the watchdog to be capable of beeping on the internal speaker should something go wrong (that'd be my queue to go fix whatever it's complaining about)

当我在 Windows 上尝试 Beep() API 时没有任何反应 - 我怀疑问题是服务会话不允许发出噪音?

when I try the Beep() API on Windows nothing happens - I suspect the problem is that the services session isnt permitted to make noises?

我可以完成这项工作吗?关于如何让服务提醒我的任何其他想法?

can I make this work? any other ideas for how to make the service alert me?

-CG

推荐答案

在 \device\beep 上调用 CreateFile,然后向下发送 IOCTL_BEEP_SET(参见 http://www.koders.com/c/fidFEC3527B9D951559D62722A9C0C603863106CA9B.aspx 详情)

Call CreateFile on \device\beep, then send down IOCTL_BEEP_SET (see http://www.koders.com/c/fidFEC3527B9D951559D62722A9C0C603863106CA9B.aspx for details)

这篇关于如何发出 Windows 服务蜂鸣声?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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