I'm trying to display a bitmap image on the client area of my window.
I'm using Charles Petzold's book "Programming Windows" but I can't seem to find how to do this?! I've looked in Chapter 14 and found a program that puts an icon file on your client area but that's not what I want.
I'm using MSVC++ ver 6.0 and Windows XP home edition.
I've added the image to my resource file and added it to my header file as well. I was just wondering how to draw it?! I can't believe I can't find it in my book!?
I was thinking you had to declare it in the window class declaration but I'm not sure where/how to put it.
Is it possible to draw the bitmap "on the fly" (ie: AFTER declaration of the window class)?
As you are using VC6 (pre .NET version) make sure you read the GDI leaks bit at the 'displaying bitmaps' link.
In the 'bitmap sample' link the code contains a GDI leak for pre .NET versions of MSVC (ie VC6).
.NET version make GDI objects in a default state that are cleaned up by the system when out of scope.
Dev-Cpp winanim example is good...
When I try to load my bitmap as a resource it seems to be successful but it says that it can't display it. I think it's because it has too many colors to display or something like that.
However, when I try to load it with my code it's unsuccessful.
If MSVC++ 6.0 can't display the bitmap resource, would that prevent it the LoadBitmap command from working?
Ok, I found a book at Border's (for $75 freaking bucks that I don't have) that said LoadBitmap doesn't work if your bitmap is more than 256 colors. Or something like that. I can't remember exactly...
In other words: if your bitmap was created on or after the time that Windows was first created then LoadBitmap won't work. :mad:
The book suggested using LoadResource for your bitmap instead.
I'm not sure how many colors my bitmap uses but how do I tell? Does the number of actual colors used dictate the number of colors it CAN use? (ie: even if I don't use 2 million colors in my bitmap, can it still be a true-color bitmap?)
Am I barking up the wrong tree?
I think LoadImage can load bitmap resources that have 256 colors.
bitmap = (HBITMAP)LoadImage(GetModuleHandle(0),