GpiQueryPageViewport

This function returns the page viewport; see GpiSetPageViewport.

Syntax
GpiQueryPageViewport(hps, prclViewport)

Parameters

 * hps (HPS) - input : Presentation-space handle.
 * prclViewport (PRECTL) - output : Page viewport.
 * The size and position of the page viewport in device units.

Return Code

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

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.
 * PMERR_INV_DC_TYPE (0x2060) : An invalid type parameter was specified with DevOpenDC, or a function was issued that is invalid for a OD_METAFILE_NOQUERY device context.

Remarks
This function must not be issued when there is no device context associated with the presentation space.

Example Code
This example uses GpiQueryPageViewport to query the page viewport, after associating a device context to the presentation space; if successful, it assigns the x coordinate of the viewport to a variable.
 * 1) define INCL_GPITRANSFORMS /* Transform functions */
 * 2) include 

BOOL fSuccess; /* success indicator */ HPS hps; /* Presentation-space handle */ RECTL prclViewport; /* page viewport */ LONG lLwrLftxCoord; /* lower left x coordinate of field */ HDC hdc; /* device context handle */

/* associate device context */ if (GpiAssociate(hps, hdc) == TRUE) { fSuccess = GpiQueryPageViewport(hps, &prclViewport); /* if successful, assign lower left x coordinate of viewport */ if (fSuccess == TRUE) lLwrLftxCoord = prclViewport.xLeft; }

Related Functions

 * GpiSetPageViewport