0

I have an app scanning a window area with this method inside a loop:

GDI32.GetPixel(ntPtr hdc, int nXPos, int nYPos)

This is working properly although in some computers it takes quite a lot of resources.

Now I will have different instances running, and the goal is that each instance scans a different area of different windows.

My questions are, if anyone has tried this before:

  • Will this same method work (GDI32.GetPixel)?
  • What about resource consumption, what if I have 4 instances running, anyone has any feedback on this?

I know it's not a very common scenario and maybe no one tried this, but just in case.

Thank you.

K. Weber
  • 2,643
  • 5
  • 45
  • 77
  • 2
    You need to make sure that you are properly releasing the DCs. But really the issue will be that you'll have multiple loops running and that will consume CPU cycles. You can alleviate that by putting a small delay between iterations of the loop, but of course that will make the loops take slightly longer. You didn't really define "resources", though. Were you talking memory usage, or CPU usage, or something else?... – Idle_Mind May 17 '22 at 12:26
  • @Idle_Mind that's what I meant, CPU and memory usage. Good point releasing the DC's, I hadn't thought of it – K. Weber May 17 '22 at 12:30

0 Answers0