Jump to content

GpiQueryPageViewport: Difference between revisions

From EDM2
Created page with "==Description== This function returns the page viewport; see GpiSetPageViewport. ==Syntax== <pre> #define INCL_GPITRANSFORMS Or use INCL_GPI, INCL_PM,: #include <os2.h> ..."
 
No edit summary
Line 69: Line 69:
==Related Functions==
==Related Functions==


[[Category:GPI]]
[[Category:Gpi]]

Revision as of 23:58, 20 January 2017

Description

This function returns the page viewport; see GpiSetPageViewport.

Syntax

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

HPS hps; /* Presentation-space handle. */
PRECTL prclViewport; /* Page viewport. */
BOOL rc; /* Success indicator. */

rc = 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.

#define INCL_GPITRANSFORMS /* Transform functions */
#include <os2.h>

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