GpiQueryBitmapDimension

From EDM2
Jump to: navigation, search

This function returns the width and height of a bit map, as specified on a previous GpiSetBitmapDimension function.

Syntax

rc = GpiQueryBitmapDimension(hbm, psizlBitmapDimension);

Parameters

hbm (HBITMAP) - input
Bit-map handle.
psizlBitmapDimension (PSIZEL) - output 
Size of bit map.
The width and height of the bit map in 0.1 millimeter units.
If not set by GpiSetBitmapDimension, zeros are returned.

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.

Example Code

This example uses GpiQueryBitmapDimension to return the width and height of a bit map, as specified on a previous GpiSetBitmapDimension call; if successful, it assigns the width to a variable.

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

BOOL fSuccess; /* success indicator */
HBITMAP hbm; /* bit-map handle */
SIZEL psizlBitmapDimension; /* size of bit map */
LONG lWidth; /* width of bit map */

fSuccess = GpiQueryBitmapDimension(hbm, &psizlBitmapDimension);

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