0

我正在使用带有 C/C++ 的 Win32Api(Windows API)。

我能够采用像素的 RGB 颜色。

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) );
}

但我不想做一个繁忙的循环。是否有任何方法或任何方法可以在不使用繁忙循环的情况下等待像素的特定颜色加载?

4

1 回答 1

0

There is no API that allows you to register a callback to be called whenever a pixel's color changes.

于 2021-04-02T16:26:20.380 回答