Hey,
I have a problem with this piece of code. It works on Windows NT based systems like Windows 2000 and Windows XP but fails to render under Windows 98. I've tried debugging it with both IDA Pro and OllyDebug but it has only been a wild goose chase. Please help. Thanks.
Attachments:
Posted on 2005-12-22 10:14:55 by MathError
Could this be the problem? From MSDN:

Windows 95/98/Me: The created bitmap cannot exceed 16MB in size.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_3ak0.asp
Posted on 2005-12-22 10:48:15 by QvasiModo
I'd like to add that 16MB bitmaps fail for sure, but other large bitmaps (say more than 2MB) fail occasionally too (on 9x platforms).
Posted on 2005-12-22 21:14:06 by ti_mo_n
It can't be too big right? I mean there are only 1024 * 1024 pixels. Are there any other ways to get around this problem? It's seriously screwing up my mind. I want it to be compatible across 2000,XP,98 and 95.
Posted on 2005-12-23 01:54:41 by MathError
I fell in such problem long time ago and I just gave up. Nowadays almost everyone uses NT-based Windows, so it's not worth the effort. You can subdivide the bitmap into 4 smaller bitmaps and then subdivide each sub-bitmap, and so on. Long and somewhat difficult to code with no real gain from it ;) I'd also like to add that many GDI functions give strange results or fail with large bitmaps, so for your own sake stick to NT :P
Posted on 2005-12-23 03:51:01 by ti_mo_n
Haha thanks for the advice. Since there's no simple solution, I think I'll listen to what you say. I'll just abandon the poor users of Windows 9x. Haha although I hope that anybody with a simple solution will post it here cuz it's a really irritating problem.Like maybe there's a way to output pixels directly to the screen or something in an easier way? I mean if IE could display large images in Win9x I don't see why I can't.
Posted on 2005-12-23 06:53:50 by MathError
MathError, as already suggested, you can "partition" the image and only have some of the image data in a BITMAP at a time - the BITMAPs are limited, but you can still HeapAlloc memory for large images.
Posted on 2005-12-23 10:26:51 by f0dder

IIRC to set an image in a static control it should have been created with CreateDIBSection. Using CreateBitmap is the worst thing to do.
Posted on 2005-12-23 11:37:38 by japheth
Argh! Thanks japheth! Haha CreateDIBSection is so great. It has no limitation on how big the bitmap is. I finally solved it. Here's my code so that nobody will repeat the same mistake in future. I finally found the right GDI function. Yay I'm so happy!  :D
Attachments:
Posted on 2005-12-25 01:05:48 by MathError