What is the maximum size of a Bitmap?

Hey there,
I was encountering a bug in my source code where CreateCompatibleBitmap() was returning NULL.

I eventually pinpointed the bug and found it was occurring when trying to create too big of a bitmap; using CreateCompatibleBitmap().

I found I could create a bitmap that was 29826W by 18000H.
(I have my reasons for wanting to create such a large bitmap.)

My questions are..

Is the size of the bitmap you can create using CreateCompatibleBitmap() const or is it variable depending on the power of your PC?

If it is constant, how many bytes is that?


----------------------------------------------------
P.S.
I went in search of this answer and this thread is the closest I got.

http://forums.codeguru.com/showthread.php?407837-GDI-Bitmap-size-limitation

Obviously, it is incorrect.



I don't know but I found this in the comments on the MSDN page for CreateCompatibleBitmap():

Windows apparently may enforce systemwide limits on available memory for CreateCompatibleBitmap. (According to some sources, this is because device-dependent bitmaps must reside in video card RAM.) If you're getting ERROR_NOT_ENOUGH_MEMORY errors when calling CreateCompatibleBitmap, the solution is to use device-independent bitmaps (DIBs) instead.

Interesting...
Topic archived. No new replies allowed.