Finding a pixel on the sceen

How do i get my mouse to find a pixel and when it has been found the mouse left clicks?

Can someone help me with this.
Last edited on
Bump
What OS are you using?
Microsoft Windows XP
Use SetCapture() to direct all mouse input to your window. When the user clicks, take note of the xPos, yPos coordinates. Transform them to the desktop space using ClientToScreen(). Once you have done that, you'll need to access the root window's DC. Here's a MSDN article on how to do just that:
http://msdn.microsoft.com/en-us/library/ms532314.aspx

Once you have a bitmap, you can either decode the pixel data directly, or convert the bitmap to the pixel format of your choice and decode the pixel data then.

You might want to google about and see who else has done what you want. It is possible someone has already written all the code to do this.

Hope this helps.
Topic archived. No new replies allowed.