GreDeviceDeletePalette

From EDM2
Jump to: navigation, search

GreDeviceDeletePalette is called by the graphics engine when a palette is selected out of a device context. This can occur in many situations, including when an application selects a new palette using GpiSelectPalette or deletes a palette using GpiDeletePalette. It informs the device to delete its instance of the palette for the given device context. The DC should be reset to the default color table. It is the responsibility of the presentation driver to determine if any other device contexts are using the palette. In this case, the presentation driver does not free the internal data structures needed for palette realization.

This function can be hooked by the presentation driver.

Simulation support
This function is simulated by a handling routine in Revision 2.0 (or later) of the graphics engine.

Syntax

GreDeviceDeletePalette(hdc, hdevpal, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
hdevpal (ULONG) - input
Handle to the device palette from GreDeviceCreatePalette.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreDeviceDeletePalette.

Returns

rc (LONG) - returns
Return codes.
On completion, this function returns the following value:
  • Error (0)
  • Successful (1)
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_IN_AREA
  • PMERR_INV_IN_PATH
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Sample

#define INCL_GRE_PALETTE
#include <os2.h>

HDC      hdc;        /*  Device context handle. */
ULONG    hdevpal;    /*  Handle to the device palette from GreDeviceCreatePalette. */
PVOID    pInstance;  /*  Pointer to instance data. */
ULONG    lFunction;  /*  High-order WORD=flags; low-order WORD=NGreDeviceDeletePalette. */
LONG     rc;         /*  Return codes. */

rc = GreDeviceDeletePalette(hdc, hdevpal, pInstance, lFunction);