IImageList2::Replace2 method (commoncontrols.h)

Replaces an image in an image list.

Syntax

HRESULT Replace2(
  [in]           int      i,
  [in]           HBITMAP  hbmImage,
  [in, optional] HBITMAP  hbmMask,
  [in, optional] IUnknown *punk,
  [in]           DWORD    dwFlags
);

Parameters

[in] i

Type: int

The index of the image to replace.

[in] hbmImage

Type: HBITMAP

A handle to the bitmap that contains the image.

[in, optional] hbmMask

Type: HBITMAP

A handle to the bitmap that contains the mask. If no mask is used with the image list, this parameter is ignored.

[in, optional] punk

Type: IUnknown*

A pointer to the IUnknown interface.

[in] dwFlags

Type: DWORD

Specifies how the mask is applied to the image as one or a bitwise combination of the following decoration flags.

Value Meaning
ILR_DEFAULT
0x0000
Not used.
ILR_HORIZONTAL_LEFT
0x0000
Horizontally align to left.
ILR_HORIZONTAL_CENTER
0x0001
Horizontally center.
ILR_HORIZONTAL_RIGHT
0x0002
Horizontally align to right.
ILR_VERTICAL_TOP
0x0000
Vertically align to top.
ILR_VERTICAL_CENTER
0x0010
Vertically align to center.
ILR_VERTICAL_BOTTOM
0x0020
Vertically align to bottom.
ILR_SCALE_CLIP
0x0000
Do nothing.
ILR_SCALE_ASPECTRATIO
0x0100
Scale.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header commoncontrols.h
DLL Comctl32.dll (version 6.0 or later)