IBitmapImage::LockBits (Windows CE 5.0)

Send Feedback

This method lets applications lock an area of a bitmap image object and access bitmap data in the specified pixel format.

HRESULT LockBits(  const RECT*   rect,  UINT          flags,  PixelFormatID pixelFormat,  BitmapData*   lockedBitmapData);

Parameters

  • rect
    [in] A pointer to a RECT structure that defines the region of the bitmap to lock.

  • flags
    [in] A UINT value that describes the type of lock.

    This value must be an ImageLockMode enumeration value or a combination of ImageLockMode values.

    This parameter must contain the values ImageLockModeRead or ImageLockModeWrite.

  • pixelFormat
    [in] A PixelFormatID value that specifies the pixel format of the locked bitmap area.

    This value must be set to one of the PixelFormat Values.

    To use the current pixel format of the bitmap image, set this value to PixelFormatDontCare.

    Bitmap image objects don't need to support all pixel formats, but they must support the canonical pixel formats.

  • lockedBitmapData
    [in, out] A pointer to an instance of a BitmapData class that contains data about the locked pixels.

    If the ImageLockModeUserInputBuf bit of the flags parameter is set, the lockedBitmapData->Scan0 and lockedBitmapData->Stride members must contain valid values on input.

    Your application must call the IBitmapImage::UnlockBits method when it is done using the pixel data. Concurrent locks are not allowed on the same bitmap image object.

Return Values

If successful, this method returns S_OK.

If it fails, this method should return one of the following error values:

  • IMGERR_BADLOCK
  • IMGERR_OBJECTBUSY
  • E_FAIL
  • E_INVALIDARG

For more information, see Error Codes for the Imaging API.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Imaging.h.
Link Library: Imaging.lib.

See Also

IBitmapImage | ImageLockMode | PixelFormatID | PixelFormat Values | BitmapData | IBitmapImage::UnlockBits

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.