A | B | C |  D | E | F |  G | H | I |  J | K | L |  M | N | O |  P | Q | R |  S | T | U |  V | W | X |  Y | Z



GetDIBits

The GetDIBits function retrieves the bits of the specified bitmap and copies them into a buffer using the specified format.

VB4-32,5,6
Declare Function GetDIBits Lib "gdi32" (ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long

VB.NET
System.Drawing.Bitmap.LockBits

Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later

Library
Gdi32

Parameter Information
- hdc
Identifies the device context.

- hbmp
Identifies the bitmap.

- uStartScan
Specifies the first scan line to retrieve.

- cScanLines
Specifies the number of scan lines to retrieve.

- lpvBits
Points to a buffer to receive the bitmap data. If this parameter is NULL, the function passes the dimensions and format of the bitmap to the BITMAPINFO structure pointed to by the lpbi parameter.

- lpbi
Points to a BITMAPINFO structure that specifies the desired format for the device-independent bitmap (DIB) data.

- uUsage
Specifies the format of the bmiColors member of the BITMAPINFO structure. It must be one of the following values:
DIB_PAL_COLORS
The color table should consist of an array of 16-bit indices into the current logical palette.
DIB_RGB_COLORS
The color table should consist of literal red, green, blue (RGB) values.

Return Values
If the lpvBits parameter is non-NULL and the function succeeds, the return value is the number of scan lines copied from the bitmap.

Windows 95:

If the lpvBits parameter is NULL and GetDIBits successfully fills the BITMAPINFO structure, the return value is the total number of scan lines in the bitmap.

Windows NT:

If the lpvBits parameter is NULL and GetDIBits successfully fills the BITMAPINFO structure, the return value is non-zero.

If the function fails, the return value is zero.

Last update: 07 April 2006