GpiQueryBackColor: Difference between revisions
Appearance
Created page with "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), lColo..." |
mNo edit summary |
||
| Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; hps ([[HPS]]) - input | ; hps ([[HPS]]) - input: Presentation-space handle. | ||
: Presentation-space handle. | |||
==Return Value== | ==Return Value== | ||
; lColor ([[LONG]]) - returns | ; lColor ([[LONG]]) - returns: Background color. | ||
: 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. | : 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== | ==Remarks== | ||
| Line 41: | Line 36: | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError: | Possible returns from WinGetLastError: | ||
; PMERR_INV_HPS (0x207F) | ; PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified. | ||
: 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_PS_BUSY (0x20F4) | ; 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. | ||
: An attempt was made to access the presentation space from more than one thread simultaneously. | ; 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. | ||
; 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== | ==Example Code== | ||
This example uses GpiQueryBackColor to return the current value of the (character) background color attribute, as set by the GpiSetBackColor call. | This example uses GpiQueryBackColor to return the current value of the (character) background color attribute, as set by the GpiSetBackColor call. | ||
<pre> | <pre> | ||
#define INCL_GPIPRIMITIVES /* Primitive functions */ | #define INCL_GPIPRIMITIVES /* Primitive functions */ | ||
#include | #include <os2.h> | ||
LONG lColor; /* current background color (or error) */ | LONG lColor; /* current background color (or error) */ | ||
HPS hps; /* Presentation-space handle */ | HPS hps; /* Presentation-space handle */ | ||
lColor = GpiQueryBackColor(hps); | lColor = GpiQueryBackColor(hps); | ||
Latest revision as of 01:28, 17 November 2025
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
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);