请问如何编程获得显示器物理(可显示区域的)尺寸等参数?
需要编程获取显示器的物理(可显示区域的)对角线尺寸大小,比如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




