DreamingOfSleep
DreamingOfSleep

Reputation: 1448

How can I take screenshots from a background process?

I want to set up a system whereby anyone logged onto a machine on our local network can see what's on the screen of any other machine on the local network. This is part of a peer-monitoring programme, and is with the agreement of all users.

All machines are running Windows 7 or 10. Ideally, I would like it that someone using an iPad could also see the screens.

My initial thought was to install IIS on each machine, and have a web site that would capture the screen and return it on request. That way, a user at another machine could just browse to http://machinename/ and see the screenshots. This would work for desktop machines and iPads.

However, I discovered that you can't access the screen that way, so that idea is out. Similarly, it seems that a Windows service can't access the screen either.

What options do I have? I want something that can be installed once for all users, and show what's on the screen(s) attached to that machine.

Upvotes: 3

Views: 1497

Answers (1)

Lex Li
Lex Li

Reputation: 63133

Like a lot of similar questions out there, a simple solution requires just some basic understanding of how Windows session isolation works, detailed in posts like this.

As you want to capture screenshots, your code must run in the same user session. Then any sample code you find from search engines will work flawlessly.

Many existing screen capture solutions are built upon this simple approach, and usually have a Windows tray app that launches when a user logs in, which prepares the screen shots by calling the capture API.

You cannot use a Windows service or a web app on IIS to call the capture API, because they run in session 0, not that user session.

Behind the scene, other necessary components are there to dispatch the screen shots to a centralized backend server (so that they can then be sent to the monitoring device).

Note that for this part multiple approaches/architectures can be used, so I won't share too much to restrict your imagination.

Upvotes: 1

Related Questions