警告窗口,一旦用户试图停止服务 [英] Warning window once the user tries to stop a service

查看:157
本文介绍了警告窗口,一旦用户试图停止服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C写一个服务,我想显示一个警告窗口,一旦用户尝试停止服务(点击确定和取消按钮)。

I'm writing a service in "C" and I'd like to display a warning window once the user tries to stop the service ( With "OK" and "Cancel" Buttons ).

有没有特定的Windows API可用于实现这一目标?
任何其他的简单方法有没有实现?

Is there any specific windows API available to achieve this? Any other simple ways are there to achieve??

推荐答案

没有,这是不可能的。 Windows服务是无法直接与用户的桌面交互,所以他们将无法显示出任何种类的用户界面。

No, this is not possible. Windows services are unable to interact directly with the user's desktop, so they will be unable to show a user interface of any kind.

这应该算不上是一个大问题,虽然。你必须有足够的权限来停止和启动服务,并且在默认情况下,只有管理员拥有这些权利。如果你不想让用户在不经意间停止服务,那么你应该利用权限来解决这个问题你。

This shouldn't really be a big deal, though. You have to have adequate permissions to stop and start a service, and by default, only Administrators have those rights. If you don't want users inadvertently stopping your service, then you should take advantage of permissions to solve that problem for you.

这篇关于警告窗口,一旦用户试图停止服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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