GreSetGlobalAttribute

From EDM2
Jump to: navigation, search

GreSetGlobalAttribute sets the specified attribute in the pen, pattern, character, image, and marker bundles.

This function is supported by the graphics engine.

Syntax

GreSetGlobalAttribute(hdc, lAttrType, lAttribute, flOptions, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
lAttrType (LONG) - input
Specifies the attribute type.
Attribute types:
ATYPE_COLOR Foreground color
ATYPE_BACK_COLOR Background color
ATYPE_MIX_MODE Foreground mix
ATYPE_BACK_MIX_MODE Background mix
Note: ATYPE_BACK_COLOR and ATYPE_BACK_MIX_MODE do not apply to the line bundle.
lAttribute (LONG) - input
New attribute value.
flOptions (ULONG) - input
The only allowable option flag is GATTR_DEFAULT, which specifies that the attribute indicated by lAttrType should be set to its default value. If the GATTR_DEFAULT flag is not set, the function sets the attribute to the value specified by lAttribute.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreSetGlobalAttribute.

Return Code

fSuccess (BOOL) - returns
Return codes.
On completion, the handling routine must return BOOLEAN (fSuccess).
  • TRUE Successful
  • FALSE Error
Possible Errors Detected: When an error is detected, the graphics engine calls WinSetErrorInfo to post the condition. Reasons for failure of this function include:
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_HDC_BUSY
  • PMERR_INV_BACKGROUND_COL_ATTR
  • PMERR_INV_BACKGROUND_MIX_ATTR
  • PMERR_INV_COLOR_ATTR
  • PMERR_INV_HDC
  • PMERR_INV_IN_AREA
  • PMERR_INV_MIX_ATTR
  • PMERR_INV_RESET_OPTIONS
Refer to the "Error Explanations" section of the Presentation Manager Programming Reference for further explanation.

Remarks

The attribute can be set to its default value or to a specified value.

Sample Code

#define INCL_GRE_DEVSUPPORT
#include <os2.h>

HDC      hdc;         /*  Device context handle. */
LONG     lAttrType;   /*  Specifies the attribute type. */
LONG     lAttribute;  /*  New attribute value. */
ULONG    flOptions;
PVOID    pInstance;   /*  Pointer to instance data. */
ULONG    lFunction;   /*  High-order WORD=flags; low-order WORD=NGreSetGlobalAttribute. */
BOOL     fSuccess;    /*  Return codes. */

fSuccess = GreSetGlobalAttribute(hdc, lAttrType,
             lAttribute, flOptions, pInstance,
             lFunction);