gpi12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GpiQueryElement (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPISEGEDITING
 
LONG GpiQueryElement(hps, off, cbMax, pb)
HPS hps;       /* presentation-space handle                 */
LONG off;      /* offset to first byte to copy              */
LONG cbMax;    /* size of the buffer                        */
PBYTE pb;      /* address of buffer for graphics-order data */
 
The GpiQueryElement function retrieves the graphics-order data for an
element in the currently open segment. The element pointer must point to the
element to retrieve. The function copies the data to the buffer pointed to
by the pb parameter, copying all bytes in the current element or the number
of bytes specified by cbMax, whichever is smaller. If off is not zero, the
function uses this parameter as an offset from the beginning of the element
to the first byte to copy to the buffer.
 
The function can be used only in an open segment and only when the drawing
mode is DM_RETAIN. It cannot be used in an element bracket.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies the presentation space.
 
off        Specifies the offset from the beginning of the segment to the
           first byte of graphics-order data for the element.
 
cbMax      Specifies the size in bytes of the pb buffer.
 
pb         Points to a buffer that receives the graphics-order data for the
           element.
 
Return Value
 
The return value specifies the number of bytes returned if the function is
successful or GPI_ALTERROR if an error occurred.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INV_HPS
     PMERR_INV_IN_ELEMENT
     PMERR_INV_LENGTH
     PMERR_INV_LENGTH_OR_COUNT
     PMERR_INV_MICROPS_FUNCTION
     PMERR_NO_CURRENT_ELEMENT
     PMERR_NOT_IN_RETAIN_MODE
     PMERR_PS_BUSY
 
Example
 
This example uses the GpiQueryElement function to retrieve the
graphics-order data for an element.
 
BYTE abElement[512];
 
/* 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           */
 
See Also
 
GpiBeginElement, GpiDeleteElement, GpiEndElement, GpiQueryElementPointer,
GpiSetElementPointer, WinGetLastError