Export (0) Print
Expand All

CreateMappedBitmap function

Creates a bitmap for use in a toolbar.

Syntax


HBITMAP CreateMappedBitmap(
  HINSTANCE hInstance,
  INT_PTR idBitmap,
  UINT wFlags,
  _In_  LPCOLORMAP lpColorMap,
  int iNumMaps
);

Parameters

hInstance

Type: HINSTANCE

Handle to the module instance with the executable file that contains the bitmap resource.

idBitmap

Type: INT_PTR

Resource identifier of the bitmap resource.

wFlags

Type: UINT

Bitmap flag. This parameter can be zero or the following value:

ValueMeaning
CMB_MASKED

Uses a bitmap as a mask.

 

lpColorMap [in]

Type: LPCOLORMAP

Pointer to a COLORMAP structure that contains the color information needed to map the bitmaps. If this parameter is NULL, the function uses the default color map.

iNumMaps

Type: int

Number of color maps pointed to by lpColorMap.

Return value

Type: HBITMAP

Returns the handle to the bitmap if successful, or NULL otherwise. To retrieve extended error information, call GetLastError.

Remarks

The function creates a new bitmap using the bitmap data and colors specified by the bitmap resource and the color mapping information.

This function is fully supported only for images with color maps; that is, images with 256 or fewer colors.

Examples

The following example code creates a bitmap from a resource and makes the color black appear transparent by mapping it to the system color for a button face.


DWORD backgroundColor = GetSysColor(COLOR_BTNFACE);
COLORMAP colorMap;
colorMap.from = RGB(0, 0, 0);
colorMap.to = backgroundColor;
HBITMAP hbm = CreateMappedBitmap(g_hInst, IDB_BITMAP1, 0, &colorMap, 1);

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Commctrl.h

Library

Comctl32.lib

DLL

Comctl32.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft