Jump to content

GpiQueryDefCharBox

From EDM2

This function returns the size of the default graphics character box in world coordinates.

Syntax

GpiQueryDefCharBox(hps, psizlSize)

Parameters

hps (HPS) - input
Presentation-space handle.
psizlSize (PSIZEL) - output
Default character-box size.

Return Value

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

Remarks

The values returned are the same as the initial default value of the character-box attribute. See GpiSetCharBox for further information.

Errors

Possible returns from WinGetLastError:

PMERR_INV_HPS (0x207F)
An invalid presentation-space handle was specified.
PMERR_PS_BUSY (0x20F4)
An attempt was made to access the presentation space from more than one thread simultaneously.
PMERR_INV_IN_RETAIN_MODE (0x208C)
An attempt was made to issue a function (for example, query) that is invalid when the actual drawing mode is not draw or draw-and-retain.

Example Code

#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS     hps;        /* Presentation-space handle. */
PSIZEL  psizlSize;  /* Default character-box size. */
BOOL    rc;         /* Success indicator. */

rc = GpiQueryDefCharBox(hps, psizlSize);

This example uses GpiQueryDefCharBox to query the initial size of the default graphics character box in world coordinates and, if the query succeeds, resets the current size back to this initial default value via GpiSetCharBox (note the required transformation from LONG to FIXED using the MAKEFIXED macro).

#define INCL_GPIPRIMITIVES /* Primitive functions */
#include <os2.h>

BOOL fSuccess; /* success indicator */
HPS hps; /* Presentation-space handle */
SIZEL psizlSize; /* default character-box size */
SIZEF psizfxSize; /* new character-box size */

fSuccess = GpiQueryDefCharBox(hps, &psizlSize);

/* if successful, set current box size to initial default value */
if (fSuccess == TRUE)
{
  psizfxSize.cx = MAKEFIXED(psizlSize.cx,0x0000);
  psizfxSize.cy = MAKEFIXED(psizlSize.cy,0x0000);
  GpiSetCharBox(hps, &psizfxSize);
}

Related Functions