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.)
Visual C++ (6.0)
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
CStatic myStatic; // Create a child bitmap static control. myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, CRect(10,10,150,50), pParentWnd); // Set the bitmap of the static control to be the // system check-mark bitmap. myStatic.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(OBM_CHECK)) );
The following example is based on LoadImage help
LoadImage(NULL, "name of file", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);