Udostępnij za pośrednictwem


CBitmap::LoadBitmap

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 
);

Parameters

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

  • nIDResource
    Specifies the resource ID number of the bitmap resource.

Return Value

Nonzero if successful; otherwise 0.

Remarks

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.

Warning

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:

OBM_UPARRROWIOBM_DNARROWIOBM_RGARROWIOBM_LFARROWI

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 Windows SDK.

Requirements

Header: afxwin.h

See Also

Reference

CBitmap Class

Hierarchy Chart

CBitmap::LoadOEMBitmap

LoadBitmap

CGdiObject::DeleteObject

Other Resources

CBitmap Members