## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### GreDeviceCreatePalette - Parameters

hdc (HDC) - input Device context handle.

ppalinfo (PPALETTEINFO) - input Pointer to table of palette data.

Pointer to table of palette data from GreCreatePalette. The structure of palinfo is as follows:

    struct _PALETTEINFO { /* palinfo */

    ULONG        flCmd;         /* Options from create                   */

    ULONG        ulFormat;      /* Specifies format of entries at create */

                                /* Must be LCOLF-CONSECRGB               */

    ULONG        clColorData;   /* Count of Palette entries              */

    RGB2   argb[0];             /* Palette entries                       */

    } PALETTEINFO; Additional RGB@ entries follow so that CLColorData-1 entries are

    defined.

hdevpal (ULONG) - input Device palette handle (NULL, if new).

If hdevpal=0, ppalinfo points to a palette information structure, which must be set into a new palette. The handle for this new palette is returned in hdevpal. The new palette is then selected into the DC.

If hdevpal is nonzero, ppalinfo is ignored, the palette is selected into the DC, and hdevpal is a device palette handle previously returned by the presentation driver. In this case, hdevpal is used to bind the palette with the new DC. This technique is the driver-level mechanism for sharing palettes among contexts on the same device.

pInstance (PVOID) - input Pointer to instance data.

lFunction (ULONG) - input High-order WORD=flags; low-order WORD= NGreDeviceCreatePalette.

rc (ULONG) - returns Return codes.

On completion, this function returns the handle to the device palette ( hdevpal).

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