How can we display bitmap pictures in the program output?  

Hello karthik, thank you for the question.

To display bitmaps on screen, in what I'm assuming is a Windows application, the function LoadImage() will load the bitmap info into memory and return a handle to the bitmap, and the function BitBlt will blit the bitmap onto the screen. Remember that one of the things you want to do is draw everything to a "memory" device context, then at the end of all the transformations on the object, blit to the "screen" device context from the memory DC, therefore creating a double buffering like atmosphere. This way, the whole image is being rendered all at once, instead of line by line, and you won't see it being drawn line by line. The following code sample should point you in the right direction:


// check to see if the bitmap loaded
if(phBitmap == NULL)
MessageBox(NULL, "File Load Error!", "Loading file...", MB_OK);

That gives you your handle to the bitmap, which you can use to manipulate the image. For further information, you can look up the LoadImage function in the MSDN. If you don't have it, you can go to www.msdn.msn.com and look it up there.

I hope this information was helpful.

- Eddie


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.