Jump to content

GpiErrorSegmentData

From EDM2
Revision as of 22:46, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function returns information about the last error that occurred during a segment drawing operation. ==Syntax== GpiErrorSegmentData(hps, plSegment, plContext) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; plSegment (PLONG) - output : Segment in which the error occurred. ; plContext (PLONG) - output : Context of the error. :; GPIE_SEGMENT :: The error occurred while processing the contents of a retained segment. :; GPIE_ELEMENT ::...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns information about the last error that occurred during a segment drawing operation.

Syntax

GpiErrorSegmentData(hps, plSegment, plContext)

Parameters

hps (HPS) - input
Presentation-space handle.
plSegment (PLONG) - output
Segment in which the error occurred.
plContext (PLONG) - output
Context of the error.
GPIE_SEGMENT
The error occurred while processing the contents of a retained segment.
GPIE_ELEMENT
The error occurred while processing the contents of a GpiElement function.
GPIE_DATA
The error occurred while processing the contents of a GpiPutData function.

Return Value

lOff (LONG) - returns
Position.
This is either the byte offset or the element number, depending on plContext:
>=0
Position
GPI_ALTERROR
Error.

Remarks

The information returned is:

  • The segment name
  • The context
  • The byte offset or element number (depending on the context).

The byte offset is returned for these contexts:

  • The error occurred within the data of a GpiElement function
  • The error occurred within the data of a GpiPutData function.

The element number is returned for the segment context.

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.

Example Code

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

HPS   hps;       /* Presentation-space handle. */
PLONG plSegment; /* Segment in which the error occurred. */
PLONG plContext; /* Context of the error. */
LONG  lOff;      /* Position. */

lOff = GpiErrorSegmentData(hps, plSegment, plContext);

This example uses GpiErrorSegmentData to query the error context and assigns a variable to the returned element number if the context is an element error.

#define INCL_GPICONTROL /* Control functions */
#include <os2.h>

LONG lOff; /* error or offset/element number */
HPS hps; /* presentation-space handle */
LONG plSegment; /* Segment in which the error occurred */
LONG plContext; /* Context of the error */
LONG lElement; /* element number causing error */

lOff = GpiErrorSegmentData(hps, &plSegment, &plContext);
if (plContext == GPIE_ELEMENT)
  lElement = lOff;

Related Functions