Displaying bitmaps (bmp files) is fairly trivial in most of the modern languages. However, Visual C++ presents a bit of a challenge.

Delphi (5.0)

On the Additional component tab, select Image and place it on a form. Select the Picture property, click the 3 dots, click load..., select a bmp file, and run the program. No big deal.

Using Resource Hacker, it appears that the bmp file is not saved as a resource. However, the executable works fine when it is moved to another directory. (I'll figure this out latter.)

The following line (attached to a button) is all it takes to load another bmp file

  Image1.Picture.LoadFromFile ('happy.bmp');
Pretty easy. I didn't even need to use the help file. (Uh, each time you type a dot the available options are presented. I just read down the list and selected the necessary options.)

This also works with jpg, jpeg, ico, emf, wmf. I suspect that gif's were omitted because of the patent problems. (Visual Basic supports gif's but warns developers that they can be sued if they use that capability in their programs.)

More Info

Visual C++ (6.0)

In most languages, if you click an object and press F1, context sensitive help on that object is presented. However, in Visual C++, the help simply says Dialog Editor Window (hey now, that's completely worthless).

In the Resource viewer, right click and select Import.... This will allow you to specify a file (use *.* to see bmp files) and specify a handle.

Place the picture object on the form. In the properties dialog, set the Type to Bitmap and Image: to the resource handle specified above.

To its credit, Visual C++ provides a bmp editor - just double click on the resource id.

I still can't figure out how to actually specify a bmp file without compiling it into the exe.

The bitmap header information is defined in wingdi.h

The following example is from CStatic::SetBitmap help

The following example is based on LoadImage help

Author: Robert Clemenzi -
URL: http:// / user / clemenzi / technical / Languages / Bitmaps.htm