Link to home
Start Free TrialLog in
Avatar of Megabyte
Megabyte

asked on

BMP

I'm currently programming under windows in c++ 4.5 by borland, my problem is that i can't get aany kind of BMP to display, and was wondering if you would have any ideas on how to write the code to display a BMP of any kind.
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

This is a synopsis.  If you have questions or need more details, ask.

1.  You probably already have a DC for the screen, or window that you want to draw to (if not let me know) but you need to create a compatible memory DC, using CreateCompatibleDC().
2,  You need to load the bitmap with LoadBitmap() or LoadImage().
3.  Select the new bitmap into the memory DC with SelectObject().(saving the previous bitmap handle so that it may be selected in when you are done.
4.  Copy the image from the memory DC to the screen DC using BitBlt() or StretchBlt().
5.  You are now done, but you have to clean up.
6.   Restore the saved bitmap to the memory DC with SelectObject().
7.  Destroy the memory DC with DeleteDC().





Note that that technique relies on the fact that LoadBitmap() or LoadImage() return device dependant bitmaps (DDB) for the display.  If you need to drtaw on other devices, like a printer, you will need to use device independant bitmaps (DIB).
Avatar of Megabyte

ASKER

A thousand thank you's if any of it works, great job E.E
If any of it works?

You probably should get it to work BEFORE accepting an answer.  That way you can get more help if you need it.  However, if you need more help, post a comment here and I can help you.