IWICImagingFactory::CreateBitmapFromHBITMAP method (wincodec.h)

Creates an IWICBitmap from a bitmap handle.

Syntax

HRESULT CreateBitmapFromHBITMAP(
  [in]  HBITMAP                     hBitmap,
  [in]  HPALETTE                    hPalette,
  [in]  WICBitmapAlphaChannelOption options,
  [out] IWICBitmap                  **ppIBitmap
);

Parameters

[in] hBitmap

Type: HBITMAP

A bitmap handle to create the bitmap from.

[in] hPalette

Type: HPALETTE

A palette handle used to create the bitmap.

[in] options

Type: WICBitmapAlphaChannelOption

The alpha channel options to create the bitmap.

[out] ppIBitmap

Type: IWICBitmap**

A pointer that receives a pointer to the new bitmap.

Return value

Type: HRESULT

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

Remarks

For a non-palletized bitmap, set NULL for the hPalette parameter.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincodec.h
Library Windowscodecs.lib
DLL Windowscodecs.dll

See also

GDI+ Bitmap class

GDI+ Bitmap.GetHBITMAP method

IWICImagingFactory

WICBitmapAlphaChannelOption