简体   繁体   中英

using c++ how do I get the rgb values of a window open on my desktop?

I have a mouse event that will move to a particular part of the screen (x,y cordinates) but I need to be able to check the pixel color of that particular x and y. I just want to be able to notice when that particular part of my screen changes which in this case the pop up is always in the same spot and the same color. Any one have any ideas, is this the wrong way to go about this? Thanks, if this is a poor explanation let me know.

In the case of windows, it is

POINT      pt;
COLORREF   cr;
HDC        hdcScreen;

hdcScreen = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
cr = GetPixel(hdcScreen, pt.x, pt.y);
DeleteDC(hdcScreen);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM