Jump to content

GpiQueryAttrMode

From EDM2
Revision as of 22:12, 6 April 2025 by Iturbide (talk | contribs) (Created page with "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 presen...")
(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

#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS  hps;   /* Presentation-space handle. */
LONG lMode; /* Current attribute mode. */

lMode = GpiQueryAttrMode(hps);

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