Results 1 to 5 of 5

Thread: GDI Limitation; Any suggestions how to overcome it?

  1. #1
    Crunchy Cat
    Guest

    Question GDI Limitation; Any suggestions how to overcome it?

    Hi, I have nearly completed a nice little animation control in VB
    6 sp5. I can have multiple collections of 'cells' (basically a class
    that contatins IPictureDisp objects and various other data) and
    can animate each collection via an independent timer control I
    constructed. I tried animating 30 independent objects (each
    about the size of a silver dollar and containing 9 frames apiece)
    and all went well. I did this on Windows NT and Win2k. I tried the
    same thing on Windows ME and *Poof*, the GDI crashed. I
    lowered the number of simultaneously animating objects to 15
    and then it worked on ME. This perplexed me as the machine in
    question had 256mb of RAM and coutless amoutns of VM. I ran
    the resource meter program and it showed that my GDI resources
    were low when I had 15 objects animating. A little more research
    informed me that the GDI on Windows 95, 98, and ME can only
    handle a low amount of graphics loaded into memory (about half
    a meg). This is due to some sort of backward compatibility
    enforcement with 16-bit applications from the old days.

    Anyhow, I am sorely dissapointed at this limitation but I need
    my control to be effective on all OS' without being a resource
    drain. My plan of attack would be to:

    1) Load a picture directly into memory (the equivelant of having
    a big pure 'void *' variable).
    2) Load the picture from memory into a IPictureDisp object.
    3) Release the IPictureDisp object when finished copying the
    desired image to a device context.

    Seeing as how there is no 'void *' data types in VB I am not quite
    sure how to go about 1). As for 2), I would need a way to copy
    the memory reference into a IPictureDisp object. Once again
    I am not sure how to go about this.

    If anyone has any suggestions on how to accomplish 1) and/or
    2) I would greatly appreciate it.

    Thanks,

    -CC

  2. #2
    Zaei
    Guest
    Take a look at the SetBitmapBits() API call. It allows you to have an array of Long values in memory, and set the pixels of an image from that array. You may also want to consider not using VB containers for anything, to allow you a bit more control over things.

    Z.

  3. #3
    Crunchy Cat
    Guest
    Thanks Z, you probably save me hours of research time

    -CC

  4. #4
    Addicted Member Janus's Avatar
    Join Date
    Aug 2001
    Location
    California
    Posts
    221

    Nooooo!

    SetBitmapBits is the deprecated devil!
    Use StretchDIBits, save yourself the whole IPictureDisp mess and copy your pixel array directly to a DC >
    "1 4m 4 1337 #4xz0r!'
    Janus

  5. #5
    Crunchy Cat
    Guest
    Yep, I cam across that puppy too . Thanks for your input!

    -CC

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