I am using Win32Api(Windows API) with C/C++.
I am able to take the pixel's RGB color.
void WaitForSinglePixel(int x, int y,COLORREF color) //Passing pixel's (X,Y) co-ordinate & the particular Color I need at that pixel.
{
COLORREF _tempcolor; //in _tempcolor I will assign current color of the pixel at (x,y)
DWORD Red = GetRValue(color); DWORD Green = GetGValue(color); DWORD Blue = GetBValue(color);
do //Creating a busy loop
{
HDC dc = GetDC(NULL);
_tempcolor = GetPixel(dc, x, y); //assigning current color of the pixel at (x,y)
ReleaseDC(NULL, dc);
} while( (GetRValue(_tempcolor) != Red) & (GetGValue(_tempcolor) != Green) & (GetBValue(_tempcolor) != Blue) );
}
But I don't want to make a busy loop. Is there any method or any way to Wait For A Pixel's particular color to load without using busy loop??
There is no API that allows you to register a callback to be called whenever a pixel's color changes.