使用UI的窗口服务 [英] Window service using UI

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

问题描述

我做了一个窗口服务.我想在窗口服务启动时打开一个窗口表单.能够在XP窗口中打开它,但是对于Vista和Window7来说却无法正常工作.谁能帮忙.

在此先感谢

I made a window service .I want to open a window form on start of the window service. Am able to open it in window XP but for window vista and window7 its not working. can anyone please help.

Thanks in Advance

推荐答案

这太好了,它是行不通的.这样做是为了防止您在服务中创建表单而造成的伤害.当您考虑服务的功能和属性时,您将了解它们不应该具有UI.请记住,Windows服务是一种应用程序,即使您注销,其他人登录或者OP重新启动并启动该服务后,也应该执行其代码,但没有人登录.表格如何经历所有这些?

您可以拥有一个单独的应用程序的单独进程,该进程可以在某些用户的帐户下合法执行,但可以与您的服务通信.这是很平常的做法.

—SA
This is so good that is does not work. It is done to prevent the harm you could make yourself by creating a form in the service. When you think about the functionality an properties of the services, you will understand that they should not have UI. Remember, a Windows service is the application which is supposed to execute its code even when you log out, somebody else logs in, or, after OP restart and start of the services, nobody logs in. Desktops replace one another or do not exist. How a form could come through all this?

You could have a separate process of a separate application which is executed legitimately under some user''s account but communicates with your service. This is a pretty usual practice.

—SA


这篇关于使用UI的窗口服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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