Jump to content

GreSetupDC

From EDM2
Revision as of 19:05, 5 April 2025 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreSetupDC initializes the device context to the region determined by flOptions.

This function can be hooked by the presentation driver.

Simulation support
This function is simulated by a handling routine in the graphics engine.

Syntax

GreSetupDC(hdc, hrgnVis, xOrg, yOrg, prclBounds, flOptions, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
hrgnVis (HRGN) - input
Visible region handle.
xOrg (LONG) - input
X-coordinate of DC origin, specified in screen coordinates.
yOrg (LONG) - input
Y-coordinate of DC origin, specified in screen coordinates.
prclBounds (PRECTL) - input
Bounding rectangle in device coordinates.
flOptions (ULONG) - input
Option flags.
These flags determine the region returned in prclBounds:
SETUPDC_VISRGN Replace the contents of the visible region of hdc with the contents of hrgnVis.
SETUPDC_ORIGIN Set the DC origin to (xOrg, yOrg).
SETUPDC_ACCUMBOUNDSON Turn on bounds accumulation. This only affects the COM_ALT_BOUND flag. If COM_ALT_BOUND (see page Calling Conventions) is not set, the bounds rectangle is reset to an empty rectangle. If COM_ALT_BOUND is already set, the bounds rectangle is not changed.
SETUPDC_ACCUMBOUNDSOFF Turn off bounds accumulation.
SETUPDC_REALCLIP Recalculate the true device clipping region. This bit is normally set, but can be 0 when immediate recalculation is not required.
SETUPDC_SETOWNER When this bit is set, the DC must belong to the current process.
SETUPDC_CLEANDC When this bit is set, the simulation marks the visible regions as valid and calls GreNotifyClipChange in the presentation driver.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreSetupDC.

Return Code

fSuccess (BOOL) - returns
Return codes.
This function returns BOOLEAN (fSuccess).
  • TRUE Successful
  • FALSE Error
Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
  • PMERR_COORDINATE_OVERFLOW
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_HDC_BUSY
  • PMERR_HRGN_BUSY
  • PMERR_INSUFFICIENT_MEMORY
  • PMERR_INV_COORD_SPACE
  • PMERR_INV_COORDINATE
  • PMERR_INV_HDC
  • PMERR_INV_HRGN
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_RECT
  • PMERR_INV_REGION_CONTROL
  • PMERR_REGION_IS_CLIP_REGION
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Declaration

#define INCL_GRE_CLIP
#include <os2.h>

HDC       hdc;         /*  Device context handle. */
HRGN      hrgnVis;     /*  Visible region handle. */
LONG      xOrg;        /*  X-coordinate of DC origin, specified in screen coordinates. */
LONG      yOrg;        /*  Y-coordinate of DC origin, specified in screen coordinates. */
PRECTL    prclBounds;  /*  Bounding rectangle in device coordinates. */
ULONG     flOptions;   /*  Option flags. */
PVOID     pInstance;   /*  Pointer to instance data. */
ULONG     lFunction;   /*  High-order WORD=flags; low-order WORD=NGreSetupDC. */
BOOL      fSuccess;    /*  Return codes. */

fSuccess = GreSetupDC(hdc, hrgnVis, xOrg, yOrg, prclBounds, flOptions, pInstance, lFunction);