Jump to content

GpiQueryAttrMode: Difference between revisions

From EDM2
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..."
 
Ak120 (talk | contribs)
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==
; lMode ([[LONG]]) - returns
;lMode ([[LONG]]) - returns: Current attribute mode.
: Current attribute mode.
:This parameter can have one of the following values:
: This parameter can have one of the following values:
:: >=0 - Current attribute mode
:; >=0
:: AM_ERROR - Error.
:: Current attribute mode
:; AM_ERROR
:: Error.


==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)
: An attempt was made to access the presentation space from more than one thread simultaneously.


==Example Code==
==Example Code==
<PRE>
#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, */
#include &lt;os2.h&gt;
HPS  hps;  /* Presentation-space handle. */
LONG lMode; /* Current attribute mode. */
lMode = GpiQueryAttrMode(hps);
</PRE>
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.
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.
<pre>
<pre>
#define INCL_GPIPRIMITIVES /* Primitive functions */
#define INCL_GPIPRIMITIVES /* Primitive functions */
#include &lt;os2.h&gt;
#include <os2.h>


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


/* query current attribute mode */
/* query current attribute mode */
Line 49: Line 32:
/* set new mode */
/* set new mode */
GpiSetAttrMode(hps, AM_PRESERVE);
GpiSetAttrMode(hps, AM_PRESERVE);
.
.
.
.
.
.
/* restore original mode */
/* restore original mode */
GpiSetAttrMode(hps, lMode);
GpiSetAttrMode(hps, lMode);

Latest revision as of 01:08, 17 November 2025

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