过程在Windows服务截图 [英] Screenshot of process under Windows Service

查看:749
本文介绍了过程在Windows服务截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须从一个Windows服务运行一个过程,从中获得的截图。

We have to run a process from a windows service and get a screenshot from it.

我们尝试了BitBlt和PrintWindow Win32调用,但都给出空白(黑色)位图。

We tried the BitBlt and PrintWindow Win32 calls, but both give blank (black) bitmaps.

如果我们从一个普通用户进程运行我们的code,它工作得很好。

If we run our code from a normal user process, it works just fine.

这是东西,甚至有可能?或者可能有另一种方法来试试?

Is this something that is even possible? Or could there be another method to try?

东西:

  1. 作为本地系统运行Windows服务,运行过程作为本地系统 - >截图失败
  2. 以管理员身份运行Windows服务,运行过程管理 - >截图失败
  3. 在运行的用户XYZ Windows应用程序,运行过程XYZ - >截图可以使用两种BitBlt的或PrintWindow
  4. 在尝试过检查允许服务与桌面交互,从本地系统

我们也注意到,PrintWindow适用于我们的情况比较好,它的工作原理,如果窗口的背后是另一扇窗。

We also noticed that PrintWindow works better for our case, it works if the window is behind another window.

有关其他的要求,无论是父子进程必须在同一个用户。我们真的不能使用模拟从一个进程到另一个。

For other requirements, both the parent and child processes must be under the same user. We can't really use impersonation from one process to another.

推荐答案

我不认为这是可能的。

我们必须改变我们的场景,我们的应用程序不是从服务启动,但一个标准的Windows程序,在角落里的NotifyIcon。

We had to change our scenario where our application wasn't started from a service, but was a standard windows program that has a NotifyIcon in the corner.

如果有人还发现一个真正的答案,让我知道。

If someone still finds a real answer, let me know.

这篇关于过程在Windows服务截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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