DisplayDib

Syntax

WORD DisplayDib(lpbi, lpBits, wFlags)

This function displays a 256-color bitmap on a standard VGA display. It reduces the display resolution to 320-by-200 or 320-by-240 and uses the full screen to display the bitmap, clipping and centering it as necessary. The function normally does not return to the application until the user presses a key or clicks a mouse button.

To call DisplayDib, an application must be the active application. All inactive applications and GDI screen updates are suspended while DisplayDib temporarily reconfigures the display.

Parameters

LPBITMAPINFO lpbi

Specifies a pointer to a BITMAPINFO header describing the bitmap to be displayed.

LPSTR lpBits

Specifies a pointer to the bitmap bits. If this parameter is NULL, the bits are assumed to follow the BITMAPINFO structure pointed to by lpbi.

WORD wFlags

Specifies options for displaying the bitmap. Use the following flags:

DISPLAYDIB_MODE_DEFAULT

Use the default mode (320 by 240) to display the bitmap.

DISPLAYDIB_MODE_320x200x8

Use 320-by-200 mode to display the bitmap.

DISPLAYDIB_MODE_320x240x8

Use 320-by-240 mode to display the bitmap. This is the default.

DISPLAYDIB_NOWAIT

Return immediately after displaying the bitmap; don't wait for a key press or mouse click before returning.

DISPLAYDIB_NOPALETTE

Ignore the palette associated with the bitmap. You can use this flag when displaying a series of bitmaps that use a common palette.

DISPLAYDIB_NOCENTER

Don't center the image. The function displays the bitmap in the lower-left corner of the display.

DISPLAYDIB_BEGIN

Switch to the low-resolution display mode and set the palette. The bitmap is not displayed.

If you are displaying a series of images that use the same palette, you can call DisplayDib with this flag to prepare the display for the bitmaps, then make a series of DisplayDib calls with the DISPLAYDIB_NOPALETTE flag. This technique eliminates the screen flicker that occurs when the display is switched between the low-resolution and standard VGA modes. To return the display to standard VGA mode, subsequently call DisplayDib with the DISPLAYDIB_END flag.

DISPLAYDIB_END

Switch back to standard VGA mode and return without displaying a bitmap. Signifies the end of multiple calls to DisplayDib. With this flag, you can specify NULL for the lpbi and lpBits parameters.

Return Value

Returns zero if successful, otherwise returns an error code. Error codes are as follows:

DISPLAYDIB_NOTSUPPORTED

DisplayDib is not supported in the current mode.

DISPLAYDIB_INVALIDDIB

The bitmap specified by lpbi is not a valid bitmap.

DISPLAYDIB_INVALIDFORMAT

The bitmap specified by lpbi specifes a type of bitmap that is not supported.

DISPLAYDIB_INVALIDTASK

The caller is an inactive application. DisplayDib can only be called by an active application.

Comments

The DisplayDib function displays bitmaps described with the Windows 3.0 BITMAPINFO data structure in either BI_RGB or BI_RLE8 format; it does not support bitmaps described with the OS/2 BITMAPCOREHEADER data structure.

When DisplayDib switches to a low-resolution display, it disables the current display driver. As a result, you cannot use GDI functions to update the display while DisplayDib is displaying a bitmap.