GpiQueryBackColor
Appearance
This function returns the current value of the (character) background color attribute, as set by the GpiSetBackColor function.
Syntax
GpiQueryBackColor(hps)
Parameters
- hps (HPS) - input
- Presentation-space handle.
Return Value
- lColor (LONG) - returns
- Background color.
- If the presentation space is in RGB mode, lColor is an RGB value of background. If the presentation space is in index mode (as set through GpiCreateLogColorTable), lColor is a CLR_* index value.
- CLR_ERROR
- Error
- CLR_DEFAULT
- Default
- Otherwise
- Background color index.
Remarks
This function is invalid when the drawing mode (see GpiSetDrawingMode) is set to retain. Valid CLR_* values are:
- CLR_BACKGROUND (0L)
- CLR_BLUE (1L)
- CLR_RED (2L)
- CLR_PINK (3L)
- CLR_GREEN (4L)
- CLR_CYAN (5L)
- CLR_YELLOW (6L)
- CLR_NEUTRAL (7L)
- CLR_DARKGRAY (8L)
- CLR_DARKBLUE (9L)
- CLR_DARKRED (10L)
- CLR_DARKPINK (11L)
- CLR_DARKGREEN (12L)
- CLR_DARKCYAN (13L)
- CLR_BROWN (14L)
- CLR_PALEGRAY (15L)
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.
- PMERR_INV_IN_RETAIN_MODE (0x208C)
- An attempt was made to issue a function (for example, query) that is invalid when the actual drawing mode is not draw or draw-and-retain.
- PMERR_INV_DC_TYPE (0x2060)
- An invalid type parameter was specified with DevOpenDC, or a function was issued that is invalid for a OD_METAFILE_NOQUERY device context.
Example Code
#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ LONG lColor; /* Background color. */ lColor = GpiQueryBackColor(hps);
This example uses GpiQueryBackColor to return the current value of the (character) background color attribute, as set by the GpiSetBackColor call.
#define INCL_GPIPRIMITIVES /* Primitive functions */ #include <os2.h> LONG lColor; /* current background color (or error) */ HPS hps; /* Presentation-space handle */ lColor = GpiQueryBackColor(hps);