系统视频信息

本文介绍了如何使用 APIGetDeviceCaps 函数获取显卡的各种性能参数,包括光栅、曲线、直线、多边形及文本等处理能力,并展示了如何枚举显示设置来获取支持的显示模式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

关于显示卡显存的获取方式已经在另一篇日志里写过,

http://blog.csdn.net/Pregunta/archive/2006/08/24/1111702.aspx

这里就不说了.

 

author : 辟邪马甲 

 

API GetDeviceCaps本身就透露了很多视频信息

只是有些参数被用的很少而已

int GetDeviceCaps(
  HDC hdc,     // handle to DC
  int nIndex   // index of capability
);
主要的一个参数就是 nIndex
现在将主要的几个性能参数列表如下
更详细的信息,请参考MSDN
RASTERCAPS  视频驱动光栅性能
/* Raster Capabilities */
#define RC_NONE
#define RC_BITBLT           1       /* Can do standard BLT.             */
#define RC_BANDING          2       /* Device requires banding support  */
#define RC_SCALING          4       /* Device requires scaling support  */
#define RC_BITMAP64         8       /* Device can support >64K bitmap   */
#define RC_GDI20_OUTPUT     0x0010      /* has 2.0 output calls         */
#define RC_GDI20_STATE      0x0020
#define RC_SAVEBITMAP       0x0040
#define RC_DI_BITMAP        0x0080      /* supports DIB to memory       */
#define RC_PALETTE          0x0100      /* supports a palette           */
#define RC_DIBTODEV         0x0200      /* supports DIBitsToDevice      */
#define RC_BIGFONT          0x0400      /* supports >64K fonts          */
#define RC_STRETCHBLT       0x0800      /* supports StretchBlt          */
#define RC_FLOODFILL        0x1000      /* supports FloodFill           */
#define RC_STRETCHDIB       0x2000      /* supports StretchDIBits       */
#define RC_OP_DX_OUTPUT     0x4000
#define RC_DEVBITS          0x8000
 
CURVECAPS 视频驱动曲线性能
/* Curve Capabilities */
#define CC_NONE             0   /* Curves not supported             */
#define CC_CIRCLES          1   /* Can do circles                   */
#define CC_PIE              2   /* Can do pie wedges                */
#define CC_CHORD            4   /* Can do chord arcs                */
#define CC_ELLIPSES         8   /* Can do ellipese                  */
#define CC_WIDE             16  /* Can do wide lines                */
#define CC_STYLED           32  /* Can do styled lines              */
#define CC_WIDESTYLED       64  /* Can do wide styled lines         */
#define CC_INTERIORS        128 /* Can do interiors                 */
#define CC_ROUNDRECT        256 /*
LINECAPS 视频驱动直线性能
/* Line Capabilities */
#define LC_NONE             0   /* Lines not supported              */
#define LC_POLYLINE         2   /* Can do polylines                 */
#define LC_MARKER           4   /* Can do markers                   */
#define LC_POLYMARKER       8   /* Can do polymarkers               */
#define LC_WIDE             16  /* Can do wide lines                */
#define LC_STYLED           32  /* Can do styled lines              */
#define LC_WIDESTYLED       64  /* Can do wide styled lines         */
#define LC_INTERIORS        128 /* Can do interiors                 */
POLYGONALCAPS 视频驱动多边形性能
/* Polygonal Capabilities */
#define PC_NONE             0   /* Polygonals not supported         */
#define PC_POLYGON          1   /* Can do polygons                  */
#define PC_RECTANGLE        2   /* Can do rectangles                */
#define PC_WINDPOLYGON      4   /* Can do winding polygons          */
#define PC_TRAPEZOID        4   /* Can do trapezoids                */
#define PC_SCANLINE         8   /* Can do scanlines                 */
#define PC_WIDE             16  /* Can do wide borders              */
#define PC_STYLED           32  /* Can do styled borders            */
#define PC_WIDESTYLED       64  /* Can do wide styled borders       */
#define PC_INTERIORS        128 /* Can do interiors                 */
#define PC_POLYPOLYGON      256 /* Can do polypolygons              */
#define PC_PATHS            512 /* Can do paths                     */
TEXTCAPS 视频驱动文本性能
/* Text Capabilities */
#define TC_OP_CHARACTER     0x00000001  /* Can do OutputPrecision   CHARACTER      */
#define TC_OP_STROKE        0x00000002  /* Can do OutputPrecision   STROKE         */
#define TC_CP_STROKE        0x00000004  /* Can do ClipPrecision     STROKE         */
#define TC_CR_90            0x00000008  /* Can do CharRotAbility    90             */
#define TC_CR_ANY           0x00000010  /* Can do CharRotAbility    ANY            */
#define TC_SF_X_YINDEP      0x00000020  /* Can do ScaleFreedom      X_YINDEPENDENT */
#define TC_SA_DOUBLE        0x00000040  /* Can do ScaleAbility      DOUBLE         */
#define TC_SA_INTEGER       0x00000080  /* Can do ScaleAbility      INTEGER        */
#define TC_SA_CONTIN        0x00000100  /* Can do ScaleAbility      CONTINUOUS     */
#define TC_EA_DOUBLE        0x00000200  /* Can do EmboldenAbility   DOUBLE         */
#define TC_IA_ABLE          0x00000400  /* Can do ItalisizeAbility  ABLE           */
#define TC_UA_ABLE          0x00000800  /* Can do UnderlineAbility  ABLE           */
#define TC_SO_ABLE          0x00001000  /* Can do StrikeOutAbility  ABLE           */
#define TC_RA_ABLE          0x00002000  /* Can do RasterFontAble    ABLE           */
#define TC_VA_ABLE          0x00004000  /* Can do VectorFontAble    ABLE           */
#define TC_RESERVED         0x00008000
#define TC_SCROLLBLT        0x00010000  /* Don't do text scroll with blt           */
 
SHADEBLENDCAPS 视频驱动阴影和混合性能
 
/* Shading and blending caps */
#define SB_NONE             0x00000000
#define SB_CONST_ALPHA      0x00000001
#define SB_PIXEL_ALPHA      0x00000002
#define SB_PREMULT_ALPHA    0x00000004
#define SB_GRAD_RECT        0x00000010
#define SB_GRAD_TRI         0x00000020
往下讨论视频卡支持的显示模式 
BOOL EnumDisplaySettings(
  LPCTSTR lpszDeviceName,  // display device
  DWORD iModeNum,          // graphics mode
  LPDEVMODE lpDevMode      // graphics mode settings
);
typedef struct _devicemode { 
  BCHAR  dmDeviceName[CCHDEVICENAME]; 
  WORD   dmSpecVersion; 
  WORD   dmDriverVersion; 
  WORD   dmSize; 
  WORD   dmDriverExtra; 
  DWORD  dmFields; 
  union {
    struct {
      short dmOrientation;
      short dmPaperSize;
      short dmPaperLength;
      short dmPaperWidth;
      short dmScale; 
      short dmCopies; 
      short dmDefaultSource; 
      short dmPrintQuality; 
    };
    POINTL dmPosition;
    DWORD  dmDisplayOrientation;
    DWORD  dmDisplayFixedOutput;
  };

  short  dmColor; 
  short  dmDuplex; 
  short  dmYResolution; 
  short  dmTTOption; 
  short  dmCollate; 
  BYTE  dmFormName[CCHFORMNAME]; 
  WORD  dmLogPixels; 
  DWORD  dmBitsPerPel; 
  DWORD  dmPelsWidth; 
  DWORD  dmPelsHeight; 
  union {
    DWORD  dmDisplayFlags; 
    DWORD  dmNup;
  }
  DWORD  dmDisplayFrequency; 
#if(WINVER >= 0x0400) 
  DWORD  dmICMMethod;
  DWORD  dmICMIntent;
  DWORD  dmMediaType;
  DWORD  dmDitherType;
  DWORD  dmReserved1;
  DWORD  dmReserved2;
#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
  DWORD  dmPanningWidth;
  DWORD  dmPanningHeight;
#endif
#endif /* WINVER >= 0x0400 */
} DEVMODE; 
 
 
根据上面提供的API和结构,我们可以做个设计,把显示模式放入容器中
 
   
   
#define  RGBBIT    _T("256 色 ")
#define  RGBSIXTEENBIT  _T("16 位增强色 ")
#define  RGBTHIRTYTWOEXBIT _T("32 位真彩色 ")
 
 
   
   
#include  < vector >
#include 
" string.h "
using   namespace  std;

typedef 
struct  tagDevDisplayMode
{
   
string strName;
   
string strValue ;
}
DEV_DISPLAY_MODE;

vector 
< DEV_DISPLAY_MODE >  ddm;

    
int  modenum  =   0 ,done  =   0 ;
    DEVMODE devMode;
    memset( 
& devMode, 0 , sizeof ( DEVMODE ) );
    CString strWith 
=   "" ;
    CString strHeight 
=   "" ;
    CString strDisplayFrequency 
=   "" ;
                     DEV_DISPLAY_MODE devdm;


    
do  
    
{
        done 
= !EnumDisplaySettings( NULL,modenum,&devMode );
        
        strWith.Format("%d ",devMode.dmPelsWidth);
        strHeight.Format(
" %d",devMode.dmPelsHeight);
        strDisplayFrequency.Format(
"(%d Hz)",devMode.dmDisplayFrequency);

        devdm.strName 
=  strWith + "x" + strHeight;
        
if ( devMode.dmBitsPerPel == 8 )
        
{
            devdm.strValue 
= RGBBIT + strDisplayFrequency;
        }

        
if ( devMode.dmBitsPerPel == 16 )
        
{
            devdm.strValue 
= RGBSIXTEENBIT + strDisplayFrequency;
        }

        
if ( devMode.dmBitsPerPel == 32 )
        
{
            devdm.strValue 
= RGBTHIRTYTWOEXBIT + strDisplayFrequency;
        }

        ddm.push_back(devdm);
        modenum 
++;
    }
  while ( ! done);


                     .....
                     ddm.clear();
 
这样就把显卡支持的所有显示模式放入了容器中..
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值