Solved

Reading color from screen

Posted on 1997-07-17
2
156 Views
Last Modified: 2012-05-04
Using Visual Basic 5, how can I find out what color is on
the screen at a certain coordinate, but not on a form that is part of my program, just at any given coordinate?
0
Comment
Question by:bryoung
2 Comments
 

Accepted Solution

by:
W. Yang earned 100 total points
ID: 1428471
You need to know few api calls
GetDestopwindow: gives you the HWND of the desktop which is the screen.
GetDC: gives you the DC(a handle of a canvas) of the given HWND.
GetPixel: returns a colour of a point from the given DC.

If you know the DC of the current screen then you can use GetPixel(DesktopDC, X, Y) = a colour.

0
 

Author Comment

by:bryoung
ID: 1428472
I really need to know how to set up these API
calls, because I've never worked with them before.
This would have been a more helpful answer if I
had previous experience in setting up these API
calls, which I don't.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question