Jump to content

GpiQueryAttrMode

From EDM2
Revision as of 01:08, 17 November 2025 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the current value of the attribute mode, as set by GpiSetAttrMode.

Syntax

GpiQueryAttrMode(hps)

Parameters

hps (HPS) - input
Presentation-space handle.

Return Value

lMode (LONG) - returns
Current attribute mode.
This parameter can have one of the following values:
>=0 - Current attribute mode
AM_ERROR - Error.

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.

Example Code

This example uses GpiQueryAttrMode to return the current value of the attribute mode and sets a new mode using GpiSetAttrMode; after the application has finished using the new mode, the original attribute mode is restored.

#define INCL_GPIPRIMITIVES /* Primitive functions */
#include <os2.h>

LONG lMode; /* current attribute mode (or error) */
HPS    hps; /* Presentation-space handle */

/* query current attribute mode */
lMode = GpiQueryAttrMode(hps);

/* set new mode */
GpiSetAttrMode(hps, AM_PRESERVE);
.
.
.
/* restore original mode */
GpiSetAttrMode(hps, lMode);

Related Functions