问题描述
如何用code,在Windows服务复选框启用:
允许与桌面服务交互
How with code , enabled in Windows service check box :allow service interact with desktop
推荐答案
我要采取一些自由这里,从关键字试图间preT你的问题。在未来,请您多花时间写你的问题,使他们有意义的另一个人谁是试图阅读和理解他们。
I'm going to take some liberties in here in trying to interpret your question from keywords. In the future, please spend more time writing your questions so that they make sense to another person who is trying to read and understand them.
有正在登录复选框在属性窗口选项卡的Windows服务,叫做允许服务与桌面交互。如果你想以编程方式检查中,您需要在使用创建的服务来指定 SERVICE_INTERACTIVE_PROCESS
标志 API。 (请参见)。
There is a checkbox under the Log On tab in the properties window for a Windows service that is called "Allow service to interact with desktop." If you're trying to check that box programmatically, you need to specify the SERVICE_INTERACTIVE_PROCESS
flag when you create your service using the CreateService
API. (See MSDN).
但是,请注意,由于Windows Vista中的,服务完全是直接与用户交互禁止的:
重要:服务不能直接与用户的交互
Windows Vista中。因此,该
一节提到的技术
标题使用交互式服务
不应该在新的code使用。
这个功能被打破,传统的智慧决定,你不应该一直依靠也无妨。服务不是为了提供一个UI或者允许任何类型的用户直接互动。微软一直以来告诫Windows NT的初期,由于可能的安全风险,此功能是可以避免的。拉里奥斯特曼认为为什么它是。他是。
This "feature" is broken, and conventional wisdom dictates that you shouldn't have been relying on it anyway. Services are not meant to provide a UI or allow any type of direct user interaction. Microsoft has been cautioning that this feature be avoided since the early days of Windows NT because of the possible security risks. Larry Osterman argues why it was always a bad idea. And he is not the only one.
有是的某些possible workarounds,但是,如果你的绝对的必须具有此功能。但我强烈建议您慎重考虑其必要性和探索其他的设计为您服务。
There are some possible workarounds, however, if you absolutely must have this functionality. But I strongly urge you to consider its necessity carefully and explore alternative designs for your service.
这篇关于Windows服务(允许服务与桌面交互)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!