如何使用 C# 获取用户会话屏幕截图 [英] How to take users session screen shot using C#

查看:61
本文介绍了如何使用 C# 获取用户会话屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想捕获连接到我的机器的所有用户屏幕.那我该怎么做呢?

I want to capture all users screens which are connected to my Machine. So how can I do that?

我想创建一个捕获用户屏幕的 Windows 服务.

I want to create a windows service which capture users screen.

谢谢拉克斯米尔

推荐答案

您可以使用 Windows 终端服务 (WTS) API 做到这一点.这是你需要做的:
1. 使用本地系统作为您的系统服务帐户.其他帐户将无法使用.
2. 调用 WTSOpenServer,然后使用 WTSEnumerateSessions 检索会话列表
3. 您将获得 WTS_SESSION_INFO 结构的列表.那里的每个项目都代表会话.您只对 State 为 WTSActive 的会话感兴趣.
4. 在循环中为您在上一步中确定的每个会话调用 CreateProcessAsUser.从会话的 WTS_SESSION_INFO 结构中指定 sessionId.要运行的进程的名称将是您最喜欢的屏幕捕获实用程序.我没有使用任何这些,但在互联网上快速搜索发现了几个选项.

You can do that using Windows Terminal Service (WTS) API. This is what you need to do:
1. Use Local system as your system service account. Other accounts will not work.
2. Call WTSOpenServer, then using WTSEnumerateSessions retrieve list of sessions
3. You will get list of WTS_SESSION_INFO structures. Each item there represents sessions. You are only interested in sessions where State is WTSActive.
4. In a loop call CreateProcessAsUser for each session you identified in previous step. Specify sessionId from the WTS_SESSION_INFO structure you have for the session. The name of the process to run would be your favorite screen capture utility. I did not use any of those, but quick search on internet turns up few options.

这篇关于如何使用 C# 获取用户会话屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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