How to take users session screen shot using C#

爷,独闯天下 提交于 2019-12-10 11:53:54

问题


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

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

Thanks Laxmilal


回答1:


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.



来源:https://stackoverflow.com/questions/4489915/how-to-take-users-session-screen-shot-using-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!