SetBitmapBits function (wingdi.h)

The SetBitmapBits function sets the bits of color data for a bitmap to the specified values.

Note  This function is provided only for compatibility with 16-bit versions of Windows. Applications should use the SetDIBits function.


LONG SetBitmapBits(
  [in] HBITMAP    hbm,
  [in] DWORD      cb,
  [in] const VOID *pvBits


[in] hbm

A handle to the bitmap to be set. This must be a compatible bitmap (DDB).

[in] cb

The number of bytes pointed to by the lpBits parameter.

[in] pvBits

A pointer to an array of bytes that contain color data for the specified bitmap.

Return value

If the function succeeds, the return value is the number of bytes used in setting the bitmap bits.

If the function fails, the return value is zero.


The array identified by lpBits must be WORD aligned.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Bitmap Functions

Bitmaps Overview