Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there something like getpixel that works on the entire screen

Status
Not open for further replies.

imdead

Programmer
Mar 29, 2005
1
US
hi im new here-but for some time now ive been trying to create a program that can retrieve a RGB colour from another program (firefox for example). i was thinking that maybe i could somehow icon the other program up top. would that work? and is there another get command that i can use to "getpixel" anywhere on the screen
 
Use FindWindow to obtain the desired window's HWND
Use GetDC to obtain that window's device context
Use GetPixel to obtain a color value inside that window
Done.

Or, if you need to capture the entire window to a bitmap...

Use FindWindow to obtain the desired window's HWND
Use GetDC to obtain that window's device context
Use CreateCompatibleDC to create a memory context to copy to
Use CreateCompatibleBitmap to create a bitmap that can hold the window picture
Use SelectObject to assign the bitmap to the memory context
Use BitBlt to do the actual copying
Use ReleaseDC to delete the memory context

Now, you have a bitmap with the contents of the window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top