GpiDeleteSegments
This function deletes all segments in the given identifier range.
Syntax
GpiDeleteSegments(hps, lFirstSegment, lLastSegment)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- lFirstSegment (LONG) - input
- First identifier in the range; it must be greater than 0.
- lLastSegment (LONG) - input
- Last identifier in the range; it must be greater than 0.
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Remarks
lFirstSegment and lLastSegment can have the same value, in which instance, only this segment is deleted. If lFirstSegment is greater than lLastSegment only the segment with identifier lFirstSegment is deleted. If one of the segments deleted is the currently open segment, there is no open segment after this function. In this instance, processing as described for GpiCloseSegment is performed. If any of the segments are in the segment chain, they are removed from the chain. This function only deletes retained segments. Note: In draw drawing mode (see GpiSetDrawingMode), the identifier of the current segment is not remembered, so it is not recognized if it occurs within the range of specified identifiers.
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_SEG_NAME (0x20C8)
- An invalid segment identifier was specified.
- 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_GPISEGMENTS /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ LONG lFirstSegment; /* First identifier in the range; it must be greater than 0. */ LONG lLastSegment; /* Last identifier in the range; it must be greater than 0. */ BOOL rc; /* Success indicator. */ rc = GpiDeleteSegments(hps, lFirstSegment, lLastSegment);
This example uses the GpiDeleteSegments function to delete segments 4 through 6, created by GpiOpenSegment.
#define INCL_GPISEGMENTS /* Segment functions */ #include <os2.h> HPS hps; /* presentation space handle */ GpiOpenSegment(hps, 4L); /* open segment 4 */ . GpiCloseSegment(hps); /* close the segment */ GpiOpenSegment(hps, 5L); /* open segment 5 */ . GpiCloseSegment(hps); /* close the segment */ GpiOpenSegment(hps, 6L); /* open segment 6 */ . GpiCloseSegment(hps); /* close the segment */ . . . GpiDeleteSegments(hps, 4L, 6L); /* delete segments 4 through 6 */