GpiQueryBitmapParameters

From EDM2
Jump to: navigation, search

This function returns information about a bit map identified by the bit-map handle.

Syntax

GpiQueryBitmapParameters(hbm, pbmpData)

Parameters

hbm (HBITMAP) - input
Bit-map handle.
pbmpData (PBITMAPINFOHEADER) - in/out
Bit-map information header.
This is a structure, that on return, is filled with data for the specified bit map. The structure includes the elements (width, height, planes, bitcount) of a bit-map information table.

Return Code

rc (BOOL) - returns 
Success indicator.
TRUE : Successful completion
FALSE : Error occurred.

Errors

Possible returns from WinGetLastError

PMERR_INV_HBITMAP (0x207B) 
An invalid bit-map handle was specified.
PMERR_HBITMAP_BUSY (0x2032) 
An internal bit map busy error was detected. The bit map was locked by one thread during an attempt to access it from another thread.

Remarks

The cbFix field of the BITMAPINFOHEADER structure must be set by the application before performing this function.

Example Code

This example uses GpiQueryBitmapParameters to return information about a bit map identified by the bit-map handle; if successful, it assigns the width field to a variable.

#define INCL_GPIBITMAPS /* Bit-map functions */
#include <os2.h>

BOOL fSuccess; /* success indicator */
HBITMAP hbm; /* bit-map handle */
BITMAPINFOHEADER pbmpData; /* bit-map information header */
USHORT usWidth; /* width of bit map */

/* set size of info structure */
pbmpData.cbFix = sizeof(BITMAPINFOHEADER);

fSuccess = GpiQueryBitmapParameters(hbm, &pbmpData);

/* if successful, assign value of bit-map width */
if (fSuccess == TRUE)
    usWidth = pbmpData.cx;

Related Functions