GpiQueryPageViewport: Difference between revisions
Appearance
No edit summary |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
This function returns the page viewport; see [[GpiSetPageViewport]]. | |||
This function returns the page viewport; see GpiSetPageViewport. | |||
==Syntax== | ==Syntax== | ||
GpiQueryPageViewport(hps, prclViewport) | |||
==Parameters== | ==Parameters== | ||
; hps (HPS) - input : Presentation-space handle. | ;hps (HPS) - input : Presentation-space handle. | ||
;prclViewport (PRECTL) - output : Page viewport. | |||
; prclViewport (PRECTL) - output : Page viewport. | :The size and position of the page viewport in device units. | ||
The size and position of the page viewport in device units. | |||
==Return Code== | ==Return Code== | ||
; rc (BOOL) - returns : Success indicator. | ;rc (BOOL) - returns: Success indicator. | ||
*TRUE - Successful completion | |||
*FALSE - Error occurred. | |||
===Errors=== | ===Errors=== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
;PMERR_INV_HPS (0x207F) : An invalid presentation-space handle was specified. | |||
; 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_PS_BUSY (0x20F4): An attempt was made to access the presentation space from more than one thread simultaneously. | ;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. | ||
; 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== | ==Remarks== | ||
Line 43: | Line 25: | ||
==Example Code== | ==Example Code== | ||
This example uses GpiQueryPageViewport to query the page viewport, after associating a device context to the presentation space; if | 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. | ||
successful, it assigns the x coordinate of the viewport to a variable. | |||
<pre> | <pre> | ||
#define INCL_GPITRANSFORMS /* Transform functions */ | #define INCL_GPITRANSFORMS /* Transform functions */ | ||
Line 68: | Line 48: | ||
==Related Functions== | ==Related Functions== | ||
*[[GpiSetPageViewport]] | |||
[[Category:Gpi]] | [[Category:Gpi]] |
Latest revision as of 01:06, 4 September 2018
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.
#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; }