GreGetHandle

From EDM2
Jump to: navigation, search

GreGetHandle returns the handle or variable (stored in the DC corresponding to iIndex) previously set by GreSetHandle.

This function is supported by the graphics engine.

Syntax

GreGetHandle(hdc, iIndex, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
iIndex (ULONG) - input
Index value.
Index value of the returned handle in the range 0 - 3. A value of 1 can be used to get the associated AVIO presentation space handle.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreGetHandle.

Return Code

rc (LONG) - returns
Return code.
On completion, the graphics engine returns the handle requested hHandle), or GPI_ALTERROR if an error occurs.
Possible Errors Detected: When an error is detected, the graphics engine calls WinSetErrorInfo to post the condition. Reasons for failure of this function include:
  • PMERR_HDC_BUSY
  • PMERR_INV_HDC
Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.

Sample Code

#define INCL_GRE_DCS
#include <os2.h>

HDC      hdc;        /*  Device context handle. */
ULONG    iIndex;     /*  Index value. */
PVOID    pInstance;  /*  Pointer to instance data. */
ULONG    lFunction;  /*  High-order WORD=flags; low-order WORD=NGreGetHandle. */
LONG     rc;         /*  Return code. */

rc = GreGetHandle(hdc, iIndex, pInstance, lFunction);