英文:
Create screenshots when running as Windows Service
问题
我已经创建了一个Java程序,使用winsw将其安装为在Win10机器上的Windows服务。该程序需要访问当前用户桌面,因为它定期使用java.awt.Robot
创建屏幕截图并处理这些截图。
由于Windows服务在它们自己的Session0中运行,这是不可能的(会得到黑色图像)。那么,在不创建另一个由用户会话自身运行的程序的情况下,我如何创建我的屏幕截图呢?
英文:
I've created a java program which is installed as a Windows service on a win10 machine using winsw. This program needs access to the current user desktop as it periodically creates screenshots (using java.awt.Robot
) and processes them.
Because windows services run in their own session0 that isn't possible (I get black images). So how can I create my screenshots without creating another program which is run by the user session itself?
答案1
得分: 0
你应该在配置文件中将<interactive>
设置为True,以允许服务与Session 0进行交互。但在UAC操作系统(Windows Vista或更高版本)中,服务不再允许与桌面交互。
示例:<interactive />
更多信息,请阅读此链接。
英文:
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.
ex :- <interactive />
For further information read this.
专注分享java语言的经验与见解,让所有开发者获益!
评论