Bitmap::UnlockBits method

The Bitmap::UnlockBits method unlocks a portion of this bitmap that was previously locked by a call to Bitmap::LockBits.


Status UnlockBits(
  IN BitmapData *lockedBitmapData



Type: BitmapData*

Pointer to a BitmapData object that was previously passed to Bitmap::LockBits.

Return Value

Type: Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.


Bitmap::LockBits and Bitmap::UnlockBits must be used as a pair. A call to the Bitmap::LockBits method of a Bitmap object establishes a temporary buffer that you can use to read or write pixel data in a specified format. After you write to the temporary buffer, a call to Bitmap::UnlockBits copies the pixel data in the buffer to the Bitmap object. If the pixel format of the temporary buffer is different from the pixel format of the Bitmap object, the pixel data is converted appropriately.


Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusheaders.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See Also




Image Pixel Format Constants

Images, Bitmaps, and Metafiles

Using Images, Bitmaps, and Metafiles