Jump to content

GpiQueryElement: Difference between revisions

From EDM2
Created page with "This function returns element content data. ==Syntax== GpiQueryElement(hps, lOff, lMaxLength, pbData); ==Parameters== ;hps (HPS) - input :Presentation-space handle. ;lOff (..."
 
Ak120 (talk | contribs)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This function returns element content data.
This function returns element content data.
==Syntax==
==Syntax==
  GpiQueryElement(hps, lOff, lMaxLength, pbData);
  GpiQueryElement(hps, lOff, lMaxLength, pbData)
 
==Parameters==
==Parameters==
;hps (HPS) - input
;hps ([[HPS]]) - input:Presentation-space handle.
:Presentation-space handle.  
;lOff ([[LONG]]) - input:Starting byte offset within the element.
;lMaxLength (LONG) - input:Maximum length of data that can be returned.
;pbData ([[PBYTE]]) - output:Element content data.
:An area of lMaxLength bytes in which the element content data is to be returned.


;lOff (LONG) - input
==Returns==
:Starting byte offset within the element.  
;lRetLength (LONG) - returns:Number of bytes returned.
::>=0 - Actual number of bytes returned
::GPI_ALTERROR - Error.


;lMaxLength (LONG) - input
:Maximum length of data that can be returned.
;pbData (PBYTE) - output
:Element content data.
:An area of lMaxLength bytes in which the element content data is to be returned.
==Returns==
;lRetLength (LONG) - returns
:Number of bytes returned.
:; >=0
::Actual number of bytes returned
:;GPI_ALTERROR
::Error.
==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_INV_ELEMENT_OFFSET (0x206A):An invalid off (offset) parameter was specified with GpiQueryElement.
;PMERR_NOT_IN_RETAIN_MODE (0x20E2)
;PMERR_NO_CURRENT_SEG (0x20E6):An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open segment.
::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_INV_ELEMENT_OFFSET (0x206A)
::An invalid off (offset) parameter was specified with GpiQueryElement.  
;PMERR_NO_CURRENT_SEG (0x20E6)
::An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open segment.
==Remarks==
==Remarks==
Returns the element content (or part of the element content) for the element to which the element pointer currently points.
Returns the element content (or part of the element content) for the element to which the element pointer currently points.


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.
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.


This function is not valid within an element bracket.
This function is not valid within an element bracket.
Line 54: Line 38:
This example uses the GpiQueryElement function to retrieve the graphics-order data for an element.
This example uses the GpiQueryElement function to retrieve the graphics-order data for an element.
<pre>
<pre>
#define INCL_GPISEGEDITING     /* GPI Segment Edit functions  */
#define INCL_GPISEGEDITING /* GPI Segment Edit functions  */
#include <os2.h>
#include <os2.h>


HPS  hps;              /* presentation space handle           */
HPS  hps;              /* presentation space handle       */
BYTE abElement[512];    /* element data buffer                 */
BYTE abElement[512];    /* element data buffer             */


/* Move pointer to first element in segment. */
/* Move pointer to first element in segment. */
Line 67: Line 51:
     512L,              /* copy no more than 512 bytes      */
     512L,              /* copy no more than 512 bytes      */
     abElement);        /* buffer to receive data          */
     abElement);        /* buffer to receive data          */
</pre>
</pre>
Definition
<pre>
#define INCL_GPISEGEDITING /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>
HPS      hps;        /*  Presentation-space handle. */
LONG    lOff;        /*  Starting byte offset within the element. */
LONG    lMaxLength;  /*  Maximum length of data that can be returned. */
PBYTE    pbData;      /*  Element content data. */
LONG    lRetLength;  /*  Number of bytes returned. */
lRetLength = GpiQueryElement(hps, lOff, lMaxLength,
              pbData);
</pre>


[[Category:Gpi]]
[[Category:Gpi]]

Latest revision as of 20:08, 12 April 2024

This function returns element content data.

Syntax

GpiQueryElement(hps, lOff, lMaxLength, pbData)

Parameters

hps (HPS) - input
Presentation-space handle.
lOff (LONG) - input
Starting byte offset within the element.
lMaxLength (LONG) - input
Maximum length of data that can be returned.
pbData (PBYTE) - output
Element content data.
An area of lMaxLength bytes in which the element content data is to be returned.

Returns

lRetLength (LONG) - returns
Number of bytes returned.
>=0 - Actual number of bytes returned
GPI_ALTERROR - Error.

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_INV_ELEMENT_OFFSET (0x206A)
An invalid off (offset) parameter was specified with GpiQueryElement.
PMERR_NO_CURRENT_SEG (0x20E6)
An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open segment.

Remarks

Returns the element content (or part of the element content) for the element to which the element pointer currently points.

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.

This function is not valid within an element bracket.

Example Code

This example uses the GpiQueryElement function to retrieve the graphics-order data for an element.

#define INCL_GPISEGEDITING /* GPI Segment Edit functions   */
#include <os2.h>

HPS  hps;               /* presentation space handle       */
BYTE abElement[512];    /* element data buffer             */

/* Move pointer to first element in segment. */

GpiSetElementPointer(hps, 1L);
GpiQueryElement(hps,    /* presentation space               */
    0L,                 /* start with first byte in element */
    512L,               /* copy no more than 512 bytes      */
    abElement);         /* buffer to receive data           */