CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  图形处理/算法

请问如何编程获得显示器物理(可显示区域的)尺寸等参数?

楼主mizhael(男儿当自强)2004-08-01 09:42:00 在 VC/MFC / 图形处理/算法 提问

需要编程获取显示器的物理(可显示区域的)对角线尺寸大小,比如20.1"寸显示器等等。另外需要获取显示器的gamma曲线,contrast,   brightness等的信息。请问该如何做呢?  
   
  我找到了下面这个很牛的几个相关的软件  
  http://www.entechtaiwan.com/lib/softosd.shtm  
   
  不知道他们是怎么做的?有大侠知道吗?是用directX吗?  
  问题点数:0、回复次数:6Top

1 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2004-08-02 15:09:21 得分 0

可能需要与显示器驱动通讯了。Top

2 楼yturieo(什么都没有)回复于 2004-08-16 13:44:17 得分 0

注册表里显示器信息里有,可以查一查。  
  从表像上来看,也不会是很准确的。Top

3 楼DentistryDoctor(不在无聊中无奈,就在沉默中变态)回复于 2004-08-16 13:49:05 得分 0

CDC::GetDeviceCapsTop

4 楼kvw3000(回家念经)回复于 2004-08-16 13:59:31 得分 0

 
  GetSystemMetrics  
  The   GetSystemMetrics   function   retrieves   various   system   metrics   (widths   and   heights   of   display   elements)   and   system   configuration   settings.   All   dimensions   retrieved   by   GetSystemMetrics   are   in   pixels.    
   
  int   GetSystemMetrics(  
      int   nIndex       //   system   metric   or   configuration   setting  
  );  
  Parameters  
  SM_CMONITORS   Windows   98,   Windows   2000:   Number   of   display   monitors   on   the   desktop.   See   Remarks   for   more   information.    
  SM_CXFULLSCREEN,  
  SM_CYFULLSCREEN   Width   and   height   of   the   client   area   for   a   full-screen   window   on   the   primary   display   monitor.   To   get   the   coordinates   of   the   portion   of   the   screen   not   obscured   by   the   system   taskbar   or   by   application   desktop   toolbars,   call   the   SystemParametersInfo   function   with   the   SPI_GETWORKAREA   value.      
  SM_CXMAXIMIZED,  
  SM_CYMAXIMIZED   Default   dimensions,   in   pixels,   of   a   maximized   top-level   window   on   the   primary   display   monitor.    
  SM_CXSCREEN,  
  SM_CYSCREEN   Width   and   height,   in   pixels,   of   the   screen   of   the   primary   display   monitor.   These   are   the   same   values   you   obtain   by   calling   GetDeviceCaps(hdcPrimaryMonitor,   HORZRES/VERTRES).    
  SM_CXVIRTUALSCREEN,  
  SM_CYVIRTUALSCREEN   Windows   98,   Windows   2000:   Width   and   height,   in   pixels,   of   the   virtual   screen.   The   virtual   screen   is   the   bounding   rectangle   of   all   display   monitors.   The   SM_XVIRTUALSCREEN,   SM_YVIRTUALSCREEN   metrics   are   the   coordinates   of   the   top-left   corner   of   the   virtual   screen.    
  SM_XVIRTUALSCREEN,  
  SM_YVIRTUALSCREEN   Windows   98,   Windows   2000:   Coordinates   for   the   left   side   and   the   top   of   the   virtual   screen.   The   virtual   screen   is   the   bounding   rectangle   of   all   display   monitors.   The   SM_CXVIRTUALSCREEN,   SM_CYVIRTUALSCREEN   metrics   are   the   width   and   height   of   the   virtual   screen.    
  Remarks  
  System   metrics   may   vary   from   display   to   display.    
   
  GetSystemMetrics(SM_CMONITORS)   counts   only   display   monitors.   This   is   different   from   EnumDisplayMonitors   which   enumerates   display   monitors   and   also   non-display   pseudo-monitors.  
   
  The   SM_ARRANGE   setting   specifies   how   the   system   arranges   minimized   windows,   and   consists   of   a   starting   position   and   a   direction.   The   starting   position   can   be   one   of   the   following   values.  
   
  Value   Meaning    
  ARW_BOTTOMLEFT   Start   at   the   lower-left   corner   of   the   screen   (default   position).    
  ARW_BOTTOMRIGHT   Start   at   the   lower-right   corner   of   the   screen.   Equivalent   to   ARW_STARTRIGHT.    
  ARW_HIDE   Hide   minimized   windows   by   moving   them   off   the   visible   area   of   the   screen.    
  ARW_TOPLEFT   Start   at   the   upper-left   corner   of   the   screen.   Equivalent   to   ARV_STARTTOP.    
  ARW_TOPRIGHT   Start   at   the   upper-right   corner   of   the   screen.   Equivalent   to   ARW_STARTTOP   |   SRW_STARTRIGHT.    
   
   
  The   direction   in   which   to   arrange   can   be   one   of   the   following   values.  
   
  Value   Meaning    
  ARW_DOWN   Arrange   vertically,   top   to   bottom.    
  ARW_LEFT   Arrange   horizontally,   left   to   right.    
  ARW_RIGHT   Arrange   horizontally,   right   to   left.    
  ARW_UP   Arrange   vertically,   bottom   to   top.    
   
   
  Top

5 楼kvw3000(回家念经)回复于 2004-08-16 14:01:36 得分 0

通过CDC::GetDeviceCaps,   按参数说明应该可以得到显示器的物理尺寸,但是并不是这么简单,不同的显示器,不同的分辨率下,不同的操作系统下均有不同的情况,似乎很是复杂,至于映射方式更是不可靠,例如MM_LOMETRIC,   输入一个500,本来应该显示5cm才对,但是根本不可琢磨.  
  Charles   Petzold的Programming   Windows(5th   Ed.)第五章The   Device   Context一节说道GetDeviceCaps和GetSystemMetrics中那几个似乎与“物理尺寸”相关的数据,只是Windows用来调整字体大小的参数罢了,同理,映射方式也只是一个“内部参考”,与实际大小没有关系。书中同时明确说过,没有办法能通过程序方法获得显示器实际尺寸,最好的办法是让用户自己输入。  
   
  Top

6 楼huaboy408(Thinking...)回复于 2004-08-16 14:08:50 得分 0

修改gamma值,这里有一个例子  
   
  http://www.codeproject.com/miscctrl/gamma_manager.asp  
   
  Top

相关问题

  • 如何编程实现改变显示器的分辩率?
  • 如何编程设置显示器的颜色值?如256色!
  • 如何编程得到显示器的尺寸,如17'
  • 如何编程检测显示器的解析度啊?
  • 询问三星SyncMaster550s显示器的参数
  • 如何得到显示器屏幕的大小参数?
  • 给推荐个高性价比17液晶显示器(编程用)
  • 用于编程的液晶显示器的尺寸该选15"还是17"?
  • 用于编程的液晶显示器的尺寸该选15"还是17"?
  • SDK编程中如果取得参数?

关键词

  • 显示器
  • getsystemmetrics
  • display

得分解答快速导航

  • 帖主:mizhael

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo