Jump to content

GreCloseScreenChangeArea

From EDM2
Revision as of 02:26, 24 March 2020 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreCloseScreenChangeArea frees the data area internal to the display driver, identified by the SCA handle, that was accumulating screen changes.

Simulation support
This function is mandatory for display drivers that want to be DCAF-enabled.

Syntax

GreCloseScreenChangeArea(hdc, hsca, pdcArg, FunN)

Parameters

hdc (HDC) - input
Any valid device context.
hsca (HSCA) - input
Handle of the SCA to be closed.
To be valid, the handle must be obtained from a previous call to GreOpenScreenChangeArea.
pdcArg (PDC) - input
Pointer to instance data.
FunN (ULONG) - input
High-order word=Flags; Low-order word=NGreCloseScreenChangeArea.

Returns

rc (BOOL) - returns
This function returns one of the following:
  • TRUE If the handle passed is recognized and no errors occurred.
  • FALSE All other cases.
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_INV_HDC
  • PMERR_NO_HANDLE
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Sample

#define INCL_GRE_SCREEN
#include <os2.h>
#include <pmddi.h>

HDC      hdc;     /*  Any valid device context. */
HSCA     hsca;    /*  Handle of the SCA to be closed. */
PDC      pdcArg;  /*  Pointer to instance data. */
ULONG    FunN;    /*  High-order word=Flags; Low-order word=NGreCloseScreenChangeArea. */
BOOL     rc;

rc = GreCloseScreenChangeArea(hdc, hsca, pdcArg, FunN);

Remarks

It is permissible to implement this function by returning 0 to indicate that the bits were not saved and, therefore, must be saved by the calling routine.

GreCloseScreenChangeArea calls EnterDriver and performs entry checks. The function checks that the hsca field matches one of the existing SCAs. If it does, the function removes the SCA from the linked list, frees the SCA memory via FreeMem and updates the linked list.

If the SCA to be closed is the last created (that is, there are no more in the linked list), then GreSetProcessControl is called to turn off the COM_SCR_BOUND bit on subsequent calls to the display driver. Resetting this bit prevents any further screen bounds accumulation until another call is made to GreOpenScreenChangeArea.

Before returning either TRUE or FALSE, GreCloseScreenChangeArea calls ExitDriver.