DevQueryCaps
This function queries the device characteristics.
Syntax
DevQueryCaps(hdc, lStart, lCount, alArray);
Parameters
- hdc (HDC) - input
- Device-context handle.
- lStart (LONG) - input
- First item of information.
The number of the first item of information to be returned in alArray, counting from zero.
- lCount (LONG) - input
- Count of items of information.
This is the count to be returned in alArray. It must be greater than zero.
- alArray (PLONG) - output
- Device capabilities.
Array of lCount elements, starting with lStart. The array elements are numbered consecutively, starting with CAPS_FAMILY. The element number constants start with 0.
If lStart + lCount -1 exceeds the current highest-defined element number, elements beyond the highest are returned as 0.
- CAPS_FAMILY
- Device type (values as for lType in DevOpenDC).
- CAPS_IO_CAPS
- Device input/output capability:
- CAPS_IO_DUMMY Dummy device
- CAPS_SUPPORTS_OP Device supports output
- CAPS_SUPPORTS_IP Device supports input
- CAPS_SUPPORTS_IO Device supports output and input.
- CAPS_TECHNOLOGY
- Technology:
- CAPS_TECH_UNKNOWN Unknown
- CAPS_TECH_VECTOR_PLOTTER Vector plotter
- CAPS_TECH_RASTER_DISPLAY Raster display
- CAPS_TECH_RASTER_PRINTER Raster printer
- CAPS_TECH_RASTER_CAMERA Raster camera
- CAPS_TECH_POSTSCRIPT PostScript** device.
- CAPS_DRIVER_VERSION
- Version identifier of the presentation driver.
- The high order word of the version identifier is 0. The low order word identifies the release, for example 0x0120 is release 1.2.
- CAPS_WIDTH
- Media width (for a full screen, maximized window for displays) in pels.
- CAPS_HEIGHT
- Media depth (for a full screen, maximized window for displays) in pels. (For a plotter, a pel is defined as the smallest possible displacement of the pen and can be smaller than a pen width.)
- CAPS_WIDTH_IN_CHARS
- Media width (for a full screen, maximized window for displays) in default character columns.
- CAPS_HEIGHT_IN_CHARS
- Media depth (for a full screen, maximized window for displays) in default character rows.
- CAPS_HORIZONTAL_RESOLUTION
- Horizontal resolution of device in pels per meter.
- CAPS_VERTICAL_RESOLUTION
- Vertical resolution of device in pels per meter.
- CAPS_CHAR_WIDTH
- Default character-box width in pels for VIO.
- CAPS_CHAR_HEIGHT
- Default character-box height in pels for VIO.
- CAPS_SMALL_CHAR_WIDTH
- Default small-character box width in pels for VIO. This is 0 if there is only one character-box size.
- CAPS_SMALL_CHAR_HEIGHT
Default small-character box height in pels for VIO. This is 0 if there is only one character-box size.
- CAPS_COLORS
Number of distinct colors supported at the same time, including reset (gray scales count as distinct colors). If loadable color tables are supported, this is the number of entries in the device color table. For plotters, the value returned is the number of pens plus one (for the background).
- CAPS_COLOR_PLANES
Number of color planes.
- CAPS_COLOR_BITCOUNT
Number of adjacent color bits for each pel (within one plane).
- CAPS_COLOR_TABLE_SUPPORT
Loadable color table support:
- CAPS_COLTABL_RGB_8 1 if RGB color table can be loaded, with a minimum support of 8 bits each for red, green, and blue.
- CAPS_COLTABL_RGB_8_PLUS 1 if color table with other than 8 bits for each primary color can be loaded.
- CAPS_COLTABL_TRUE_MIX 1 if true mixing occurs when the logical color table has been realized, providing that the size of the logical color table is not greater than the number of distinct colors supported (see element CAPS_COLORS).
- CAPS_COLTABL_REALIZE 1 if a loaded color table can be realized.
- CAPS_MOUSE_BUTTONS
- The number of pointing device buttons that are available. A returned value of 0 indicates that there are no pointing device buttons available.
- CAPS_FOREGROUND_MIX_SUPPORT
- Foreground mix support:
- CAPS_FM_OR Logical OR.
- CAPS_FM_OVERPAINT Overpaint.
- CAPS_FM_XOR Logical XOR.
- CAPS_FM_LEAVEALONE Leave alone.
- CAPS_FM_AND Logical AND.
- CAPS_FM_GENERAL_BOOLEAN All other mix modes; see "GpiSetMix" in Graphics Programming Interface Programming Reference.
- The value returned is the sum of the values appropriate to the mixes supported. A device capable of supporting OR must, as a minimum, return CAPS_FM_OR + CAPS_FM_OVERPAINT + CAPS_FM_LEAVEALONE, signifying support for the mandatory mixes OR, overpaint, and leave-alone.
- Note that these numbers correspond to the decimal representation of a bit string that is six bits long, with each bit set to 1 if the appropriate mode is supported.
- Those mixes returned as supported are guaranteed for all primitive types. For more information, see "GpiSetMix" in Graphics Programming Interface Programming Reference.
CAPS_BACKGROUND_MIX_SUPPORT Background mix support:
CAPS_BM_OR Logical OR.
CAPS_BM_OVERPAINT Overpaint.
CAPS_BM_XOR Logical XOR.
CAPS_BM_LEAVEALONE Leave alone.
CAPS_BM_AND Logical AND.
CAPS_BM_GENERAL_BOOLEAN All other mix modes; see "GpiSetMix" in Graphics Programming Interface Programming Reference.
CAPS_BM_SRCTRANSPARENT Provides a transparent overlay function by not copying pels from the source bit map to the output bit map if they match the presentation space background color.
CAPS_BM_DESTTRANSPARENT Provides a transparent underlay function by copying only the pels that match the presentation space background color from the source bit map to the output bit map.
The value returned is the sum of the values appropriate to the mixes supported. A device must, as a minimum, return CAPS_BM_OVERPAINT + CAPS_BM_LEAVEALONE, signifying support for the mandatory background mixes overpaint, and leave-alone.
Note that these numbers correspond to the decimal representation of a bit string that is four bits long, with each bit set to 1 if the appropriate mode is supported.
Those mixes returned as supported are guaranteed for all primitive types. For more information, see "GpiSetMix" in Graphics Programming Interface Programming Reference.
CAPS_VIO_LOADABLE_FONTS Number of fonts that can be loaded for VIO.
CAPS_WINDOW_BYTE_ALIGNMENT Whether or not the client area of VIO windows should be byte-aligned:
CAPS_BYTE_ALIGN_REQUIRED Must be byte-aligned.
CAPS_BYTE_ALIGN_RECOMMENDED More efficient if byte-aligned, but not required.
CAPS_BYTE_ALIGN_NOT_REQUIRED Does not matter whether byte-aligned.
CAPS_BITMAP_FORMATS Number of bit-map formats supported by device.
CAPS_RASTER_CAPS Capability for device raster operations:
CAPS_RASTER_BITBLT 1 if GpiBitBlt and GpiWCBitBlt is supported.
CAPS_RASTER_BANDING 1 if banding is supported
CAPS_RASTER_BITBLT_SCALING 1 if GpiBitBlt and GpiWCBitBlt with scaling is supported.
CAPS_RASTER_SET_PEL 1 if GpiSetPel is supported.
CAPS_RASTER_FONTS 1 if this device can draw raster fonts.
CAPS_RASTER_FLOOD_FILL 1 if GpiFloodFill is supported.
CAPS_MARKER_HEIGHT Default marker-box height in pels.
CAPS_MARKER_WIDTH Default marker-box width in pels.
CAPS_DEVICE_FONTS Number of device-specific fonts.
CAPS_GRAPHICS_SUBSET Graphics drawing subset supported. (3 indicates GOCA DR/3)
CAPS_GRAPHICS_VERSION Graphics architecture version number supported. (1 indicates Version 1)
CAPS_GRAPHICS_VECTOR_SUBSET Graphics vector drawing subset supported. (2 indicates GOCA VS/2)
CAPS_DEVICE_WINDOWING Device windowing support:
CAPS_DEV_WINDOWING_SUPPORT 1 if device supports windowing.
Other bits are reserved 0.
- CAPS_ADDITIONAL_GRAPHICS
- Additional graphics support:
- CAPS_GRAPHICS_KERNING_SUPPORT 1 if device supports kerning.
- CAPS_FONT_OUTLINE_DEFAULT 1 if device has a default outline font.
- CAPS_FONT_IMAGE_DEFAULT 1 if device has a default image font.
- CAPS_SCALED_DEFAULT_MARKERS 1 if default markers are to be scaled by the marker-box attribute.
- CAPS_COLOR_CURSOR_SUPPORT 1 if device supports colored cursors.
- CAPS_PALETTE_MANAGER 1 if device supports palette functions (see "GpiCreatePalette" in the Graphics Programming Interface Programming Reference).
- CAPS_COSMETIC_WIDELINE_SUPPORT 1 if device supports cosmetic thick lines (see "GpiSetLineWidth" in the Graphics Programming Interface Programming Reference).
Other bits are reserved 0.
- CAPS_PHYS_COLORS
- Maximum number of distinct colors available on the device.
- CAPS_COLOR_INDEX
- Maximum logical color-table index supported for this device. For the EGA and VGA drivers, the value is 63.
- CAPS_GRAPHICS_CHAR_WIDTH
- Default graphics character-box width, in pels.
- CAPS_GRAPHICS_CHAR_HEIGHT
- Default graphics character-box height, in pels.
- CAPS_HORIZONTAL_FONT_RES
- Effective horizontal device resolution in pels per inch, for the purpose of selecting fonts.
- For printers, this is the actual device resolution, but for displays it may differ from the actual resolution for reasons of legibility.
- CAPS_VERTICAL_FONT_RES
- Effective vertical device resolution in pels per inch, for the purpose of selecting fonts.
- CAPS_DEVICE_FONT_SIM
- Identifies which simulations are valid on device fonts.
Valid flags are:
- CAPS_DEV_FONT_SIM_BOLD
- CAPS_DEV_FONT_SIM_ITALIC
- CAPS_DEV_FONT_SIM_UNDERSCORE
- CAPS_DEV_FONT_SIM_STRIKEOUT
- CAPS_LINEWIDTH_THICK
- Cosmetic thickness of lines and arcs on this device, when fxLineWidth is LINEWIDTH_THICK (see "GpiSetLineWidth" in the Graphics Programming Interface Programming Reference). The units are pels. A value of 0 is interpreted as 2 pels.
- CAPS_DEVICE_POLYSET_POINTS
- Number of points in a polyset that a device can handle.
Return Code
- rc (BOOL) - returns
- Success indicator.
- TRUE Successful completion
- FALSE Error occurred.
- Errors
Possible returns from WinGetLastError
- PMERR_INV_HDC (0x207C)
- An invalid device-context handle or (micro presentation space) presentation-space handle was specified.
- PMERR_INV_QUERY_ELEMENT_NO (0x20BC)
- An invalid start parameter was specified with DevQueryCaps.
- PMERR_INV_LENGTH_OR_COUNT (0x2092)
- An invalid length or count parameter was specified.
Remarks
GpiQueryDevice can be used to find the handle of the currently associated device context.
Example Code
#define INCL_DEV /* Or use INCL_PM, Also in COMMON section */ #include <os2.h> HDC hdc; /* Device-context handle. */ LONG lStart; /* First item of information. */ LONG lCount; /* Count of items of information. */ PLONG alArray; /* Device capabilities. */ BOOL rc; /* Success indicator. */ rc = DevQueryCaps(hdc, lStart, lCount, alArray);
In this example the driver is queried to see if it supports input, output, or both. Note that a valid device context handle must be passed. This example assumes a DevOpenDC call has been made to obtain the device context handle.
#define INCL_DEV #include <OS2.H> HDC hdc; LONG lStart; LONG lCount; BOOL flreturn; LONG alArray[CAPS_TECHNOLOGY]; lCount = CAPS_TECHNOLOGY; lStart = CAPS_FAMILY; flreturn = DevQueryCaps(hdc, /* device context handle */ lStart, /* number of first item */ lCount, /* count of items */ alArray); /* array of longs which */ /* will contain the return */ /* information. */ switch(alArray[CAPS_IO_CAPS]) /* we test the CAPS_IO_CAPS */ /* element of the array to */ /* find out which options */ { /* are supported. */ case CAPS_IO_SUPPORTS_OP: /* device supports output.*/ break; case CAPS_IO_SUPPORTS_IP: /* device supports input. */ break; case CAPS_IO_SUPPORTS_IO: /* device supports both */ /* input and output. */ break; default: break; }
Related Functions
- Prerequisite Functions
- DevOpenDC (for CAPS_FAMILY)
- Related Functions
- DevQueryDeviceNames
- DevQueryHardCopyCaps