CBitmap::LoadBitmap

This method loads the bitmap resource named by lpszResourceName, or identified by the identifier number in nIDResource, from the application’s executable file. The loaded bitmap is attached to the CBitmap object.

At a Glance

Header file: Afxwin.h
Platforms: H/PC 2.0, Palm-size PC, H//PC Pro
Windows CE versions: 1.0 and later
Complete documentation: Visual C++ documentation

Syntax

BOOL LoadBitmap ( LPCTSTR lpszResourceName );

BOOL LoadBitmap ( UINT nIDResource );

Remarks

In Windows CE, when you use the CBitmap::LoadBitmap method to initialize a CBitmap object, the bitmap is read-only. This is because Windows CE does not copy the bitmap into RAM, as the Windows-based desktop platforms do. In Windows CE, the bitmap only exists in a resource, which is part of the program's executable file. When you select the bitmap into a device context, you cannot modify the device context — for example, by drawing text into it — because that would require the ability to write to the bitmap.

Windows CE does not support any predefined bitmaps, so you cannot use any of the OBM_* values in the lpszResourceName parameter.

Because Windows CE 1.0 only supports a 2 bit gray scale palette, use one bit per pixel (monochrome .bmp) or two bit per pixel (.2bp) bitmaps.

See Also

CBitmap::LoadOEMBitmap, CGdiObject::DeleteObject