Export (0) Print
Expand All


Loads the bitmap resource named by lpszResourceName or identified by the ID number in nIDResource from the application's executable file.

BOOL LoadBitmap(
   LPCTSTR lpszResourceName 
BOOL LoadBitmap(
   UINT nIDResource 



Points to a null-terminated string that contains the name of the bitmap resource.


Specifies the resource ID number of the bitmap resource.

Nonzero if successful; otherwise 0.

The loaded bitmap is attached to the CBitmap object.

If the bitmap identified by lpszResourceName does not exist or if there is insufficient memory to load the bitmap, the function returns 0.

You can use the CGdiObject::DeleteObject function to delete bitmap loaded by the LoadBitmap function, or the CBitmap destructor will delete the object for you.

Caution noteCaution

Before you delete the object, make sure it is not selected into a device context.

The following bitmaps were added to Windows versions 3.1 and later:


These bitmaps are not found in device drivers for Windows versions 3.0 and earlier. For a complete list of bitmaps and a display of their appearance, see the Platform SDK.

Community Additions

© 2014 Microsoft