LoadBitmap

A version of this page is also available for

Windows Embedded CE 6.0 R3

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 MAKEINTRESOURCE macro 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 lpBitmapName parameter does not exist or there is insufficient memory to load the bitmap, the function fails.

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

Bitmaps returned from LoadBitmap are not writable. All calls to write to a bitmap returned by the LoadBitmap function 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

Reference

CreateBitmap
DeleteObject
LoadIcon
MAKEINTRESOURCE