The Joel on Software Discussion Group (CLOSED)

A place to discuss Joel on Software. Now closed.

This community works best when people use their real names. Please register for a free account.

Other Groups:
Joel on Software
Business of Software
Design of Software (CLOSED)
.NET Questions (CLOSED)
Fog Creek Copilot

The Old Forum

Your hosts:
Albert D. Kallal
Li-Fan Chen
Stephen Jones

can I programmatically access pixel color on the screen?

in other words, I am thinking of an app that could sort of "see" my entire computer screen. Well, I can programmatically find out width and height of the screen in C#, so now the only thing missing is actually finding out the color of the pixels by their absolute coordinates. Does anybody know how to do that?
Michael L Send private email
Thursday, April 30, 2009
You can BitBlt the contents of the screen to a bitmap. I haven't done it in C#, but it was easy enough when I did it in C++.
sloop Send private email
Friday, May 01, 2009
That would be a fun security violation, if you could paint over another application.
Scorpio Send private email
Friday, May 01, 2009
I once wrote an app to do something similar for a demo -- took a screenshot, popped open a top-level window and painted the snapshot on it, then did lots of stuff underneath to the running apps where no one could see, then removed my top-level window when done.  Worked like a charm :)

Similar approaches are a great source of practical jokes.  One thing you can do is take a snapshot of a coworker's screen and set it as their background image.  Then minimize all the apps.  Somehow none of their apps respond when they click on them :)
Doug Send private email
Friday, May 01, 2009
Search for "screen capture" on codeproject.  There are several sample applications that should get you started, like this
Jason Send private email
Friday, May 01, 2009
"...take a snapshot of a coworker's screen and set it as their background image"

Yeah, that reminds me of a series of practical jokes that were played on a team-leader on a project I used to work on.  As well as the screenshot as background image, the LAN admin guy changed his account to require a change of password every day, each with a minimum of 16 characters.

It is amazing what some people will accept if they think it is "official policy".
Scorpio Send private email
Monday, May 04, 2009

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz