Click to See Complete Forum and Search --> : fetching window bits


dave2k
April 11th, 2006, 10:06 AM
ok, i am using the 'standard code' for getting window contents into a BYTE array, using memory device contexts, getbitmapbits etc etc which works fine. the window screen i am fetching is 800 by 600, and every time my code uses all these functions, the process uses about 4% of my cpu. i am pretty sure this is the work of the api functions, but then i have todo processing on the bits, ading another few percent.

i would like to get the cpu % right down cosidering my code is run every second.

the way i currently process the bits is to have my code work out where exaclty in the array the bits are to process, and then process them. this probly takes a huge amount of time considering the size the 800*600.

i was wondering whether it would be more efficient to get the bits of inidividual areas of the screen. i would say that the amount of pixels i am actually analysing is less than 10% of the amount of the pixels in the window.

MrViggy
April 11th, 2006, 10:27 AM
this probly takes a huge amount of time considering the size the 800*600.
Based on this sentence, I suggest you time it. Get yourself a profiler of some sort (Rational Quantify is one), and see if it really does take a lot of time.

Experimentation is the best way to figure out what parts of code to optimize.

Viggy