0

I'm using AutoItX library to search for a pixel in a certain area. Unfortunately it always returns X=0, Y=0 on whatever coordinates or color for the PixelSearch method. I can't find any documentation either.

Code:

var rgb = desiredPixelColor.ToArgb();
Rectangle rect = new Rectangle()
{
    X = 200,
    Y = 200,
    Width = 400,
    Height = 400
};

try
{
    Process p = Process.GetProcessById(ID);
    if (p != null)
    {
        IntPtr h = p.MainWindowHandle;
        SetForegroundWindow(h);

        var search = AutoItX.PixelSearch(rect, rgb);
        Thread.Sleep(5000);
        if (!search.IsEmpty)
        {
            DoubleClickAtPos(search.X, search.Y);
            return true;
        }
    }
}
 catch
{
    MessageBox.Show("No pixel found");

}

No matter what coordinates or color, PixelSearch always returns 0 values. Not even null. Also tried smaller values but the result is always the same.

user4157124
  • 2,809
  • 13
  • 27
  • 42
qkory
  • 9
  • 1
  • Does this answer your question? [PixelSearch in certain area of monitor](https://stackoverflow.com/questions/46553291/pixelsearch-in-certain-area-of-monitor) – user4157124 Jun 11 '23 at 23:29

0 Answers0