CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Location
    southampton, UK
    Posts
    1,320

    fetching window bits

    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.
    With sufficient thrust, pigs fly just fine. However, this is not
    necessarily a good idea. It is hard to be sure where they are going to
    land, and it could be dangerous sitting under them as they fly
    overhead. -- RFC 1925

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: fetching window bits

    Quote Originally Posted by dave2k
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured