0

I have a application that will capture the screen and I want to write the captured information to an array, this takes AGES as the array ends up being +2million values. I am iterating and adding the values to the array, is there any way quicker (eg binary operations)? Should it be this slow? Why is it?

Deanna
  • 23,876
  • 7
  • 71
  • 156
marscom
  • 615
  • 2
  • 11
  • 24

2 Answers2

1

Assuming your GetPixel'ing the screen pixel by pixel, its the GetPixel call that's slow (it interrogates the display driver) not the (pre-dimensioned) array assignment.

You can instead use the getdibits() api which will copy the DC's colour info into a buffer in a single call.

Here is a C++ example, but the methodology & call sequence is the same as for VB.

Community
  • 1
  • 1
Alex K.
  • 171,639
  • 30
  • 264
  • 288
1

Figured out why it was so slow, it was because I was using ReDim on every iteration of the loop - thanks for the help anyways

Martin

marscom
  • 615
  • 2
  • 11
  • 24