问题
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