Solved

BMP

Posted on 1998-04-10
5
263 Views
Last Modified: 2013-11-19
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.
0
Comment
Question by:Megabyte
  • 4
5 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1184188
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1184189
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().





0
 
LVL 22

Expert Comment

by:nietod
ID: 1184190
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).
0
 

Author Comment

by:Megabyte
ID: 1184191
A thousand thank you's if any of it works, great job E.E
0
 
LVL 22

Expert Comment

by:nietod
ID: 1184192
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.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Writing a parser for java language 4 83
How to gracefully close the c++ 11 thread? 3 106
Best book to learn C++ 4 83
svg images disappeared after editing 7 58
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Not only does Prezi allow you to create non-linear presentations, it also makes it easy to apply transition animations between your frames. Learn how to apply a fade-in transition to select items and entire frames in this tutorial Select "Edit Path"…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question