简体   繁体   English

作为 Windows 服务运行时创建屏幕截图

[英]Create screenshots when running as Windows Service

I've created a java program which is installed as a Windows service on a win10 machine using winsw.我创建了一个 java 程序,它作为 Windows 服务安装在使用 winsw 的 win10 机器上。 This program needs access to the current user desktop as it periodically creates screenshots (using java.awt.Robot ) and processes them.该程序需要访问当前用户桌面,因为它会定期创建屏幕截图(使用java.awt.Robot )并处理它们。

Because windows services run in their own session0 that isn't possible (I get black images).因为 windows 服务在自己的 session0 中运行,这是不可能的(我得到黑色图像)。 So how can I create my screenshots without creating another program which is run by the user session itself?那么如何在不创建由用户 session 本身运行的另一个程序的情况下创建我的屏幕截图呢?

You should set <interactive> True in your configurations file in order to allow service to interact with Session 0. But in UAC OS(Windows vista or Above) services are no longer allow to interact with the Desktop.您应该在配置文件中设置<interactive> True 以允许服务与 Session 0 交互。但在 UAC OS(Windows vista 或更高版本)中,服务不再允许与桌面交互。

ex:- <interactive />例如:- <interactive />

For further information read this.欲了解更多信息,请阅读此内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM