GpiQueryElementPointer
Appearance
This function returns the current element pointer.
Syntax
GpiQueryElementPointer(hps)
Parameters
- hps (HPS) - input
- Presentation-space handle.
Return Value
- lElement (LONG) - returns
- Current element pointer.
- >=0 : Current element pointer
- GPI_ALTERROR : Error.
Remarks
This function is only valid when the drawing mode (see GpiSetDrawingMode) is set to retain (not draw-and-retain), and a segment bracket is currently in progress.
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_MICROPS_FUNCTION (0x20A1)
- An attempt was made to issue a function that is invalid in a micro presentation space.
- PMERR_NOT_IN_RETAIN_MODE (0x20E2)
- An attempt was made to issue a segment editing element function that is invalid when the actual drawing mode is not set to retain.
- PMERR_NO_CURRENT_SEG (0x20E6)
- An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open segment.
Example Code
This example uses GpiQueryElementPointer to return the current element pointer after setting the Draw mode to retain and beginning a graphics segment named 1.
#define INCL_GPISEGEDITING /* Segment Editing functions */
#define INCL_GPICONTROL /* Control functions */
#define INCL_GPISEGMENTS /* Segment functions */
#include <os2.h>
LONG lElement; /* current element pointer */
HPS hps; /* Presentation-space handle */
/* set the draw mode to retain and open the segment */
if (GpiSetDrawingMode(hps, DM_RETAIN) == TRUE &&
GpiOpenSegment(hps, 1L) == TRUE)
{
lElement = GpiQueryElementPointer(hps);
GpiCloseSegment(hps); /* close the segment */
}