Delphi getDeviceCaps function

GetDeviceCaps function function: This function retrieves the device specified information of the specified device.
  
Function prototype: int GetDeviceCaps(HDC hdc, int nlndex);
Parameter:
  1, hdc: the handle of the device context.
  2, nIndex: Specify the return item, this parameter takes one of the following values. (C++)
  DRIVERVERSION: Device driver version.
  TECHNOLOGY: Equipment technology, it can be one of the following values:
  DT_PLOTTER: vector plotter; DT_RASDISPLAY: raster display;
  DT_RASPRINTER: raster printer; DT_RASCAMERA: raster camera;
  DT_CHARSTREAM: character stream; DT_METAFILE: graphic element File;
  DT_DISPFILE: display file.
   If the hdc parameter specifies the device context environment of the metafile, the device technology is the CreateEnhMetaFile letter
number of reference devices, use GetObjectType function to determine whether it is an enhanced metafile device context.
  HORZSIZE: the width of the physical screen (mm); VERTSIZE: the height of the physical screen (mm); HORZRES: screen Width (pixels);
  VERTRES: the height of the screen (raster lines);
  LOGPIXELSX: The number of pixels per logical inch along the width of the screen. In a multi-display system, this value is the same for all displays;< br data-filtered="filtered">  LOGPIXELSY: The number of pixels per logical inch along the height of the screen. In a multi-display system, this value is the same for the display;
  BITSPIXEL: pixel connected color bit; PLANES: color bit surface; NUMBRUSHES: device specifies the same number of brushes;
  NUMPENS: the number of pens specified by the device; NUMFONTS: the number of fonts specified by the device;
  NUMCOLORS: The number of entries in the device color table, if the color depth of the device does not exceed 8-bit pixels. For devices exceeding the color depth, return -1;
  ASPECTX: the relative width of device pixels used for drawing lines; ASPECTY: The relative height of the device pixels used for drawing lines;
  ASPECTXY: The device pixels used for drawing lines Diagonal width; PDEVLCESIZE: reserved;
  CLIDCAPS: Displays the logo that the device supports cutting performance. If the device can be cut into a rectangle, it is 1, otherwise it is 0;
  SIZEPALETTE: system palette The number of entries in the index value is valid only when the device driver sets the RC PALETFE bit in the RASTERCAPS index.
and the index value can only be used for 16-bit Windows drives;
  NUMRESERVED: The number of entries reserved in the system palette. This index value is only available when the device driver sets the RC PALETFE bit in the RASTERLAP index
A Windows drive that is valid and the index value can only be 16-bit;
  COLORRES: The actual device color of the actual bit image. Only when the device driver sets the RCPALETFE bit in the RASTERLAP index, the index value is valid and the Search
The quoted value can only be used for 16-bit Windows drives;
  PHYSICALWIDTH: For printing devices, this is the physical page width in device units. For example, a physical sheet of a printer set to 600dpi on 8.5*11 paper
bit width value is 5100, Note that the physical page is always larger than the printable page area, and never smaller than;
  PHPSICALHEIGHT: in units of equipment The physical page width. For example, the physical unit height of a printer set to 600dpi on 8.5*11 paper is 6600;
  PHYSICALOFFSETX : For printing equipment, the distance from the left of the physical page to the right of the printed page, for example, a printer set to 600dpi on 8.5*11 paper,
Cannot be printed beyond 0.25 on the left, and there is a horizontal physical displacement of 150 units;
  PHYSICALOFFSETY; For printing equipment. The distance from the top of the physical page to the top of the printed page. For example, a printer set on 8.5*11 printing paper can’t
print beyond the top. And there is a physical displacement of a device unit;
  VREFRESH: Windows NT: For display devices. The current vertical refresh rate of the device is the number of cycles per second. 0 or 1 refresh rate represents the default refresh rate of the display hardware.
This default refresh rate is usually changed by setting the jumper of the graphics card or motherboard, or set by a configuration program that does not use Win32 display functions such as ChangeDisplay Setting;
  DESKTOPHORZRES: Windows NT: The width of the visible desktop in pixels. If the device supports a visual desktop or dual display, this value may be greater than VERTRES;
  SCALINGFACTORX: printer x-axis Scaling factor; SCALINGFACTORY: Scaling factor of the y-axis of the printer.
  BLTALIGNMENT: as a pixel multiple of horizontal drawing adjustment in Windows NT, for the best drawing operation, window drawing It should be a multiple of the level adjusted to this value.
0 The display device is accelerated and can be adjusted in any way.
  SHADEBLENDCAPS: In Windows 98, Windows NT 5.0 and later versions, this value shows the shadow and mixing characteristics of the device.
  SB_CONST_ALPHA: Process the Source constantAlpha element in the BLENDFUNCTION structure and specify it through the blendFunction parameter in the AlphaBlend number;< /span>
  SB_GRAD_RECT: The ability to fill in a Gradientfill rectangle. SB_GRAD_TRI; The ability to perform gradientfill triangle filling;
  SB_NONE: The device does not support any of these features. SB_PIXEL_ALPHA: Process each pixel Alphx in AlphaBlond;
  SB_PREMULT_ALPHA: Premultiply alpha in Alphablend;
  SB_PREMULT_ALPHA: Premultiply alpha in Alphablend;
span>
  RASTERCAPS: The raster performance supported by the device can be a combination of the following values;
  RC_BANDING: requires joint support. RC_BITBLT: Support bitmap transmission.
  RC_BITMAP64: Supports bitmaps larger than 64K. RC_DI_BITMAP: Support SetDIBits and GetDIBits functions.
  RC_DIBTODEV: Support SetDIBits To Device function; RC_FLOODFILL: Support continuous filling
  RC_GDI20_OUTPUT: supports 16-bit Windows 2.0 features; RC_PALETTE: specifies a palette-based device.
  RC_SCALING: supports scaling; RC_STRETCHBLT: supports StretchBlt function.
  RC_STRETCHDIB: stretchDIBits function.
  CURVECAPS: The curve performance supported by the display device can be a certain combination of the following values.
  CC_NONE: does not support drawing curves; CC_CHORD: supports drawing chords; CC_CIRCLES: supports drawing circles.
  CC_ELLIPSES: supports drawing ellipses; CC_INTERIORS: supports internal filling; CC_PIE: supports drawing pie graphs.
  CC_ROUNDRECT: Support drawing rounded rectangles; CC_STYLED: Support drawing borders with style.
  CC_WIDE: supports drawing wide borders; CC_WIDESTYLED: supports drawing wide, styled borders.
The line drawing performance supported by   LINECAPS devices can be a combination of the following values:< br data-filtered="filtered">  LC_NONE: does not support drawing line segments; LC_INTERIORS: supports internal filling; LC_MARKER: supports drawing markers.
  LC_POLYLINE: support polyline; LC_POLYMARKER: support multiple markers; LC_STYLED: line segment with style.
  LC_WIDE: Support drawing wide lines; LC_WIDESTYLED: Support wide styled line segments.
  POLYGONALCAPS has supported polygon performance. It can be some combination of the following values.
  PC_NONE: does not support drawing polygons; PC_INTERIORS: supports internal filling; PC_POLYGON: supports drawing interval filled polygons.
  PC_RECTANGLE: supports drawing rectangles; PC_SCANLINE: supports drawing scan lines; PC_STYLED: supports drawing borders with style.
  PC_WIDE: Support drawing wide border; PC_WIDESTYLED: Support drawing wide border with style.
  PC_WINDPOLYGON: Support drawing polyline filled polygons.
  The text performance supported by the TEXTCAPS device can be a combination of the following values:
  TC_OP_CHARACTER: Support character output accuracy; TC_OP_STROKE: Support stroke output accuracy.
  TC_CP_STROKE: support stroke cutting precision; TC_CR_90: support character rotation by 90 degrees;
  TC_CR_ANY: Support characters to rotate at any angle; TC_SF_X_YINDEP: Support independent scaling in x and y directions.
  TC_SA_DOUBLE: Supports double magnification of characters; TC_SA_INTEGER: Supports integer zoom.
  TC_SA_CONTIN: Supports strict scaling by any multiple; TC_EA_DOUBLE: Supports character emphasis.
  TC_IA_ABLE: supports italic font; TC_UA_ABLE: supports underline; TC_SO_ABLE: supports strikethrough.
  TC_RA_ABLE: supports raster fonts; TC_VA_ABLE: supports vector fonts; TC_RESERVED: reserved, must be zero.
  TC_SCROLLBLT: It does not support scrolling with bit speed transfer. Note that this may be counterproductive.
   The above are some C++ parameters, the following provides the specific values ​​of some parameters in C#
  All types can be declared as Int or INT32.
  DRIVERVERSION = 0
  TECHNOLOGY = 2
  HORZSIZE = 4
  VERTSIZE = 6
  HORZRES = 8
  VERTRES = 10
  BITSPIXEL = 12
  PLANES = 14
  NUMBRUSHES = 16
  NUMPENS = 18
  NUMMARKERS = 20
  NUMFONTS = 22
  NUMCOLORS = 24
  PDEVICESIZE = 26
  CURVECAPS = 28
  LINECAPS = 30
  POLYGONALCAPS = 32
  TEXTCAPS = 34
  CLIPCAPS = 36
  RASTERCAPS = 38
  ASPECTX = 40
  ASPECTY = 4 2
  ASPECTXY = 44
  SHADEBLENDCAPS = 45
  LOGPIXELSX = 88
  LOGPIXELSY = 90
  SIZEPALETTE = 104
  NUMRESERVED = 106
  COLORRES = 108
  PHYSICALWIDTH = 110
  PHYSICALHEIGHT = 111
  PHYSICALOFFSETX = 112
  PHYSICALOFFSETY = 113
  SCALINGFACTORX = 114
  SCALINGFACTORY = 115
  VREFRESH = 116
  DESKTOPVERTRES = 117
  DESKTOPHORZRES = 118
  BLTALIGNMENT = 119
   Return value: The return value specifies the value of the required item.
  Note: GetDeviceCaps provides the following six indexes to replace the disappearance of the printer.
  PHYSICALWIDTH GETPHYSPAGESIZE; PHYSICALHEIGHT GETPHYSPAGESIZE
  PHYSICALOFFSETX GETPRINTINGOFFSET;
  PHYSICALOFFSETY GETPHYSICALOFFSET;
  SCALINGFACTORX GETSCALINGFACTOR;
  SCALINGFACTORY GETSCALINGFACTOR;
  Windows CE: Windows CE does not support the nIndex parameter to take the following values:
  VREFRESH; DESKTOPHORZRES; DESKTOPVERTRES;BLTALIGNMENT
  Windows CE 1.0 does not support the following values ​​for the nIndex parameter:
  PHYSICALWIDTH; PHYSICALHEIGHT; PHYSICALOFFSETX; PHYSICALOFFSETY
  PHYSICALWIDTH; PHYSICALHEIGHT; PHYSICALOFFSETX; PHYSICALOFFSETY s pan>
  Quick search: Windows NT: 3.1 and above; Windows: 95 and above; Windows CE: 1.0 and above ; Header file: wingdi.h; Library file: gdi32.lib.
  Add:
  GetDeviceCaps(HORZSIZE)
  HORZSIZE Display width in millimeters< br data-filtered="filtered">  VERTSIZE Display height in millimeters
  HORZRES display width in pixels 0~65535
  VERTRES in pixels Display height of 0~65535
  LOGPIXELSX pixels/logical inches (horizontal)
  LOGPIXELSY pixels/logical inches (vertical)

Leave a Comment

Your email address will not be published.