![]() |
How to do this...
Hi, I want to write a program that reads a pixel on the screen and then does A if the pixel is of certain color and B if it's not. So the change of the color of the pixel (x,y) on my screen can trigger things. Can this be done easily? I'm a newbie programmer so I don't really have any idea of where to start. I just really need a program that can do this. Also if you know that it can be done more easily with some other language than C++ then feel free to tell me because I can always learn the language enough to write the effect-part.
|
Re: How to do this...
This is in C# but you should be able to use the information contained in the article to write a similar program in C++
http://sharpinsights.wordpress.com/2...r-under-mouse/ |
Re: How to do this...
I recently did this in C#, I had to use a pinvoke to use some windows methods.
The only difficulty's i ran into was to read the pixels that were 'outside' of my current program. I cant remember exactly how I did it, ( i think there was a default handle to use ). I will post my code tonight when I have access to it. |
Re: How to do this...
Were you using the DC of the application window?? Try getting the DC of the desktop window instead :)
|
Re: How to do this...
|
Re: How to do this...
Quote:
It's slightly more complicated to do it in c++/c# because of the window handle stuff. |
Re: How to do this...
Here it is in c#, should be easy to convert it to c++.
:
using System; |
Re: How to do this...
Thank you, everyone. Great help :) I'm gonna try some of this later today or tomorrow, I'm sure I'll get something done.
|
Re: How to do this...
Is it a good idea to keep keep on recreating hdcScreen each time you call getColorAt ?
|
Re: How to do this...
Quote:
|
| All times are GMT -5. The time now is 3:17 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC