Re: BUG in CreateCompatibleBitmap with VC++.NET/2003

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Relvinian (smpres_at_hotmail.com)
Date: 12/04/04


Date: Sat, 04 Dec 2004 02:13:55 -0700

ATS wrote:
> Thanks for the reply, but you only addressed 1/2 of the issue. The issue was
> that either CreateCompatibleBitmap has a bug and/or the dozens of MSDN
> articles that have been stating for years since 1995 to use
> CreateCompaitbleBitmap for a "memory" bitmap are wrong. For example, that
> article titled "Flicker-Free Displays Using an Off-Screen DC" doesn't mention
> that, "oh, by the way, using CreateCompatibleBitmap with VC++ 2003 will only
> work about 5 times before blowing up with a lack or memory error".
>
> At any rate, I found a way to use CImage to do the equivalent of
> CreateCompatibleBitmap, but for best results, Microsoft should warn others
> and update the articles.

ATS,

You can create as many bitmaps as you want. What is the limits is the
amount of memory available for creating bitmaps. If you create LARGE
bitmaps, you won't be able to create very many, that is why it is
recommended to use DIBs instead because they come from virtual memory
and not physical memory.

In my own applications and testing, I have created over 300+ bitmaps
using CreateCompatibleBitmap and they were all created just fine.
Granted almost all of these bitmaps were in the range of around 32x32
pixels or smaller. Some larger but most small.

There isn't a bug with it or the documentation is flawed. It works as
designed and documented. Just need to know when to use the right API
call for the job.

Relvinian



Relevant Pages

  • Re: WM5 - Dll memory limits
    ... I never said the bitmaps are loded from the dll. ... So, if we assume that I'm almost out of memory, can you please help me ... Join the Embedded Developer Community ... Checking lasterror informs me that the dll could not be loaded. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Picture control max size?
    ... applies to a screen compatible memory DC and an associated screen ... Boxes painted to a 4x4 grid on the new control) ... device independent (a DIBSection, for example) because DIBSections ... bitmaps, and you can make those memory bitmaps whatever colour depth you ...
    (microsoft.public.vb.general.discussion)
  • Re: One thing I noticed
    ... just wanted to show you that the Autoredraw picture box way is *not* ... You can create memory bitmaps using Classic VB. ... You can't destroy them immediately if you're actually using them! ...
    (microsoft.public.vb.general.discussion)
  • Re: WM5 - Dll memory limits
    ... It's likely that this is what's running you out of memory - having too many ... Bitmaps created and in use at any given time. ... Join the Embedded Developer Community ... and it looks as if I've run out of some memory space, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: !RPFS - Remote PrinterFS
    ... Xerox colour laser as its memory management wasn't anything like as ... An A4 page at 4800x1200 will produce immense bitmap files. ... postmaster at invalid dot org dot uk ...
    (comp.sys.acorn.networking)