GpiQueryElementType: Difference between revisions
Appearance
Created page with "This function returns information about the element to which the element pointer currently points. ==Syntax== GpiQueryElementType(hps, plType, lLength, pszData) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; plType (PLONG) - output : Element type. : The element type can be system-defined or application-defined; see GpiElement and GpiBeginElement. ; lLength (LONG) - input : Data length. : Length of the description data buffer...." |
mNo edit summary |
||
| Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; hps ([[HPS]]) - input | ; hps ([[HPS]]) - input: Presentation-space handle. | ||
: Presentation-space handle. | ; plType ([[PLONG]]) - output: Element type. | ||
; plType ([[PLONG]]) - output | |||
: Element type. | |||
: The element type can be system-defined or application-defined; see [[GpiElement]] and [[GpiBeginElement]]. | : The element type can be system-defined or application-defined; see [[GpiElement]] and [[GpiBeginElement]]. | ||
; lLength ([[LONG]]) - input: Data length. | |||
; lLength ([[LONG]]) - input | |||
: Data length. | |||
: Length of the description data buffer. | : Length of the description data buffer. | ||
; pszData ([[PSZ]]) - output: Description of data buffer. | |||
; pszData ([[PSZ]]) - output | |||
: Description of data buffer. | |||
: The description may be system-defined or application-defined; see [[GpiElement]] and [[GpiBeginElement]]. The string is null-terminated, even if it has to be truncated. | : The description may be system-defined or application-defined; see [[GpiElement]] and [[GpiBeginElement]]. The string is null-terminated, even if it has to be truncated. | ||
==Return Value== | ==Return Value== | ||
; lReqLength ([[LONG]]) - returns | ; lReqLength ([[LONG]]) - returns: Size of the data required to hold the element content. | ||
: Size of the data required to hold the element content. | |||
: This can be used for a subsequent [[GpiQueryElement]] function. | : This can be used for a subsequent [[GpiQueryElement]] function. | ||
: | :: >=0 : Size of data | ||
:: GPI_ALTERROR : Error. | |||
: | |||
==Remarks== | ==Remarks== | ||
| Line 34: | Line 24: | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError: | Possible returns from WinGetLastError: | ||
; PMERR_INV_HPS (0x207F) | ; PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified. | ||
: 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_PS_BUSY (0x20F4) | ; PMERR_INV_MICROPS_FUNCTION (0x20A1): An attempt was made to issue a function that is invalid in a micro presentation space. | ||
: An attempt was made to access the presentation space from more than one thread simultaneously. | ; PMERR_NO_CURRENT_ELEMENT (0x20E5): An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open element. | ||
; PMERR_INV_MICROPS_FUNCTION (0x20A1) | ; 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. | ||
: An attempt was made to issue a function that is invalid in a micro presentation space. | ; PMERR_INV_LENGTH_OR_COUNT (0x2092): An invalid length or count parameter was specified. | ||
; PMERR_NO_CURRENT_ELEMENT (0x20E5) | ; PMERR_INV_IN_ELEMENT (0x2089): An attempt was made to issue a function invalid inside an element bracket. | ||
: An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open element. | ; PMERR_NO_CURRENT_SEG (0x20E6): An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open segment. | ||
; 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_INV_LENGTH_OR_COUNT (0x2092) | |||
: An invalid length or count parameter was specified. | |||
; PMERR_INV_IN_ELEMENT (0x2089) | |||
: An attempt was made to issue a function invalid inside an element bracket. | |||
; PMERR_NO_CURRENT_SEG (0x20E6) | |||
: An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open segment. | |||
==Example Code== | ==Example Code== | ||
This example uses the GpiQueryElementType function to retrieve the size of the current element. The size is used to retrieve the graphics-order data in the element. | This example uses the GpiQueryElementType function to retrieve the size of the current element. The size is used to retrieve the graphics-order data in the element. | ||
<pre> | <pre> | ||
#define INCL_GPISEGEDITING /* GPI Segment Edit functions */ | #define INCL_GPISEGEDITING /* GPI Segment Edit functions */ | ||
#include | #include <os2.h> | ||
HPS hps; /* presentation space handle */ | HPS hps; /* presentation space handle */ | ||
Latest revision as of 01:49, 24 November 2025
This function returns information about the element to which the element pointer currently points.
Syntax
GpiQueryElementType(hps, plType, lLength, pszData)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- plType (PLONG) - output
- Element type.
- The element type can be system-defined or application-defined; see GpiElement and GpiBeginElement.
- lLength (LONG) - input
- Data length.
- Length of the description data buffer.
- pszData (PSZ) - output
- Description of data buffer.
- The description may be system-defined or application-defined; see GpiElement and GpiBeginElement. The string is null-terminated, even if it has to be truncated.
Return Value
- lReqLength (LONG) - returns
- Size of the data required to hold the element content.
- This can be used for a subsequent GpiQueryElement function.
- >=0 : Size of data
- 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. It is not valid in an element bracket.
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_NO_CURRENT_ELEMENT (0x20E5)
- An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open element.
- 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_INV_LENGTH_OR_COUNT (0x2092)
- An invalid length or count parameter was specified.
- PMERR_INV_IN_ELEMENT (0x2089)
- An attempt was made to issue a function invalid inside an element bracket.
- 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 the GpiQueryElementType function to retrieve the size of the current element. The size is used to retrieve the graphics-order data in the element.
#define INCL_GPISEGEDITING /* GPI Segment Edit functions */
#include <os2.h>
HPS hps; /* presentation space handle */
BYTE abElement[512];
LONG cbElement;
LONG lType;
/* move pointer to first element in segment */
GpiSetElementPointer(hps, 1L);
cbElement = GpiQueryElementType(
hps, /* presentation space */
&lType, /* variable to receive type */
0L, /* copy zero bytes of description */
NULL); /* no buffer for description */
GpiQueryElement(hps, 0L, cbElement, abElement);