Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function loads the specified bitmap resource from the executable file for a module.

Syntax

HBITMAP LoadBitmap(
  HINSTANCE 
hInstance, 
  LPCTSTR 
lpBitmapName
); 

Parameters

hInstance

[in] Handle to the instance of the module for which the executable file contains the bitmap that you want to load.

lpBitmapName

[in] Long pointer to a null-terminated string that contains the name of the bitmap resource that you want to load.

Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word.

The MAKEINTRESOURCEmacro can be used to create this value.

The maximum value for the resource identifier is 32000.

Return Value

The handle to the specified bitmap indicates success.

NULL indicates failure.

To get extended error information, call GetLastError.

Remarks

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

The application must call the DeleteObjectfunction to delete each bitmap handle returned by the LoadBitmapfunction.

Bitmaps returned from LoadBitmapare not writable. All calls to write to a bitmap returned by the LoadBitmapfunction will fail.

Windows CE 1.0 supports only a 2-bit gray scale palette, so use only a bitmap that is 1 bit per pixel (monochrome .bmp) or 2 bits per pixel (.2bp).

Requirements

Header winuser.h
Library Loadbmp.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also