Jump to content

GreGetCurrentPosition

From EDM2
Revision as of 23:18, 17 January 2020 by Martini (talk | contribs) (Created page with "GreGetCurrentPosition takes the current (X,Y) position in world coordinates from the DC instance data structure and stores it at the location addressed by pptlPosition. If COM...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreGetCurrentPosition takes the current (X,Y) position in world coordinates from the DC instance data structure and stores it at the location addressed by pptlPosition. If COM_TRANSFORM is not set, the current position is returned in screen coordinates.

This function must be supported by all presentation drivers. GreGetCurrentPosition is called by the GpiQueryCurrentPosition function. GreGetCurrentPosition might also be called in response to any of the Presentation Manager drawing functions that begin their operation from the current position within the presentation space.

Simulation support
None. This function is mandatory for all drivers.

Syntax

GreGetCurrentPosition(hdc, pptlPosition, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
pptlPosition (PPOINTL) - input
Pointer to current position.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreGetCurrentPosition.

Returns

rc (BOOL) - returns
Return Code.
On completion, the handling routine must return a BOOLEAN value to indicate success or an error.
  • TRUE Successful
  • FALSE Error
Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_INV_HDC
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Sample

#define INCL_GRE_LINES
#include <os2.h>

HDC        hdc;           /*  Device context handle. */
PPOINTL    pptlPosition;  /*  Pointer to current position. */
PVOID      pInstance;     /*  Pointer to instance data. */
ULONG      lFunction;     /*  High-order WORD=flags; low-order WORD=NGreGetCurrentPosition. 

 */
BOOL       rc;            /*  Return Code. */

rc = GreGetCurrentPosition(hdc, pptlPosition,
       pInstance, lFunction);