Jump to content

GreDeviceGetAttributes

From EDM2
Revision as of 16:14, 30 November 2019 by Martini (talk | contribs) (Created page with "GreDeviceGetAttributes queries the attribute values currently set in the device. This function must be supported by the presentation driver. ; Simulation support: None. Th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreDeviceGetAttributes queries the attribute values currently set in the device.

This function must be supported by the presentation driver.

Simulation support
None. This function is mandatory for all drivers.

Syntax

GreDeviceGetAttributes(hdc, lPrimType, flAttrsMask, pAttrs, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
lPrimType (LONG) - input
Bundle primitive type.

Indicates the bundle type. Valid primitive values are:

  • PRIM_LINE Line attribute bundle (see Line Attributes.
  • PRIM_CHAR Character attribute bundle see Character Attributes.
  • PRIM_MARKER Marker attribute bundle see Marker Attributes.
  • PRIM_AREA Area (Pattern) attribute bundle see Area (Pattern) Attributes.
  • PRIM_IMAGE Image attribute bundle see Image Attributes.
flAttrsMask (ULONG) - input
Attribute mask.
Specifies the attributes to be returned. This mask contains a bit corresponding to each attribute in the bundle record that is required. For each set bit, the handling routine must return the corresponding attribute values and default mask bits. Only the foreground color and background color attributes can be requested for any primitive type.
pAttrs (PBUNDLE) - input
Pointer to the fixed-format bundle record to which the attributes are returned. Fields other than those indicated by flAttrsMask must not be modified.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreDeviceGetAttributes.

Returns

rc (BOOL) - returns
Return Codes.

On completion, the handling routine must return a BOOLEAN value to indicate success or an error.

  • TRUE Successful
  • FALSE Error

Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:

  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_INV_HDC

Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.


Sample

#define INCL_GRE_DEVMISC1
#include <os2.h>

HDC        hdc;          /*  Device context handle. */
LONG       lPrimType;    /*  Bundle primitive type. */
ULONG      flAttrsMask;  /*  Attribute mask. */
PBUNDLE    pAttrs;
PVOID      pInstance;    /*  Pointer to instance data. */
ULONG      lFunction;
BOOL       rc;           /*  Return Codes. */

rc = GreDeviceGetAttributes(hdc, lPrimType,
       flAttrsMask, pAttrs, pInstance, lFunction);