Export (0) Print
Expand All

LoadBitmap function

[LoadBitmap is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use LoadImage and DrawFrameControl.]

The LoadBitmap function loads the specified bitmap resource from a module's executable file.

Syntax


HBITMAP LoadBitmap(
  _In_  HINSTANCE hInstance,
  _In_  LPCTSTR lpBitmapName
);

Parameters

hInstance [in]

A handle to the instance of the module whose executable file contains the bitmap to be loaded.

lpBitmapName [in]

A pointer to a null-terminated string that contains the name of the bitmap resource to be loaded. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can be used to create this value.

Return value

If the function succeeds, the return value is the handle to the specified bitmap.

If the function fails, the return value is NULL.

Remarks

If the bitmap pointed to by the lpBitmapName parameter does not exist or there is insufficient memory to load the bitmap, the function fails.

LoadBitmap creates a compatible bitmap of the display, which cannot be selected to a printer. To load a bitmap that you can select to a printer, call LoadImage and specify LR_CREATEDIBSECTION to create a DIB section. A DIB section can be selected to any device.

An application can use the LoadBitmap function to access predefined bitmaps. To do so, the application must set the hInstance parameter to NULL and the lpBitmapName parameter to one of the following values.

Bitmap nameBitmap name
OBM_BTNCORNERSOBM_OLD_RESTORE
OBM_BTSIZEOBM_OLD_RGARROW
OBM_CHECKOBM_OLD_UPARROW
OBM_CHECKBOXESOBM_OLD_ZOOM
OBM_CLOSEOBM_REDUCE
OBM_COMBOOBM_REDUCED
OBM_DNARROWOBM_RESTORE
OBM_DNARROWDOBM_RESTORED
OBM_DNARROWIOBM_RGARROW
OBM_LFARROWOBM_RGARROWD
OBM_LFARROWDOBM_RGARROWI
OBM_LFARROWIOBM_SIZE
OBM_MNARROWOBM_UPARROW
OBM_OLD_CLOSEOBM_UPARROWD
OBM_OLD_DNARROWOBM_UPARROWI
OBM_OLD_LFARROWOBM_ZOOM
OBM_OLD_REDUCEOBM_ZOOMD

 

Bitmap names that begin with OBM_OLD represent bitmaps used by 16-bit versions of Windows earlier than 3.0.

For an application to use any of the OBM_ constants, the constant OEMRESOURCE must be defined before the Windows.h header file is included.

The application must call the DeleteObject function to delete each bitmap handle returned by the LoadBitmap function.

Examples

For an example, see Example of Menu-Item Bitmaps in Using Menus.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

LoadBitmapW (Unicode) and LoadBitmapA (ANSI)

See also

Bitmaps Overview
Bitmap Functions
CreateBitmap
DeleteObject
DrawFrameControl
LoadCursor
LoadIcon
LoadImage
MAKEINTRESOURCE

 

 

Community Additions

ADD
Show:
© 2014 Microsoft