Jump to content

GpiQueryPalette

From EDM2
Revision as of 17:47, 24 February 2020 by Martini (talk | contribs) (Related Functions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the handle of the palette currently selected into a presentation space.

Syntax

hpal = GpiQueryPalette(hps);

Parameters

hps (HPS) - input
Presentation-space handle.

Return Code

hpal (HPAL) - returns
Palette handle.
  • NULLHANDLE Null handle (no palette is selected)
  • PAL_ERROR Error occurred
  • Otherwise Handle of the palette currently selected into this presentation space.

Errors

Possible returns from WinGetLastError

PMERR_INV_HPS (0x207F)
An invalid presentation-space handle was specified.
PMERR_PS_BUSY (0x20F4)
An attempt was made to access the presentation space from more than one thread simultaneously.

Remarks

It is possible for a palette to be selected into more than one presentation space at any one time. See GpiSelectPalette.

Example Code

This example uses GpiQueryPalette to return the handle of the palette currently selected into a presentation space and then calls GpiDeletePalette to delete the palette.

#define INCL_GPILOGCOLORTABLE /* Color Table functions */
#include <os2.h>

HPAL hpal; /* palette handle */
HPS hps; /* Presentation-space handle */
BOOL fSuccess; /* success indicator */

/* get handle of currently associated palette */
hpal = GpiQueryPalette(hps);

/* delete palette */
fSuccess = GpiDeletePalette(hpal);