Board logo

标题: 实现显示器的尺寸大小的批处理 [打印本页]

作者: dengxinhuaisme     时间: 2009-11-15 13:45    标题: 实现显示器的尺寸大小的批处理

各位大侠好,小弟想提一个问题。

怎样用批处理判断显示器的尺寸大小呢?然后将得到的判断节果写入一个文本文档中。然后再将此文本文档命名为显示器尺寸的名字,如:是17寸的,则命名为17.txt
小弟很菜鸟,不过很热爱批处理,后面的重命名我还是会的。
作者: AlexZhang     时间: 2009-11-15 22:41
尺寸大小?这个要看显示器驱动了吧,不是显卡驱动.我看Xorg实现了,但是移植到DOS可能不现实
作者: dengxinhuaisme     时间: 2009-11-16 09:10
就是用批处理判断显示器是十几英寸的。

不知道怎么实现
作者: boylovedos     时间: 2009-11-22 20:52
好难的!我不会——观察中的小菜鸟;有会的——度假中的高手们。
让我们耐心等等吧!
作者: azziporah     时间: 2009-12-1 10:45
Sorry I can't type Chinese currently...
First of all, you have to understand when we're talking about the SIZE of a monitor, we're ACTUALLY talking about the MAX viewable image size of a monitor, or "diameter".

I have to say, due to no direct info about diameter is provided, it's not easy to get the diameter of your monitor without the help of a 3rd party tool.
(BTW, the resolution is easy to get, however it can't be used to calculate the diameter of your monitor.)

Recently in a computer, all info about the monitor come from EDID(a VESA defined data structure, for detail: http://en.wikipedia.org/wiki/EDID). EDID BYTE 21 and BYTE 22 define the horizontal/vertical MAX viewable image size, separately.
You could get EDID via I2C, perform a calculation with EDID BYTE 21 and BYTE 22, and a conversion from centimeter to inch, the result you get is very close to the desired monitor-size.

Another approach is much easier: by the name of the monitor, like "DELL E228WFP" indicating 22-inch. However even if you could get the name from EDID or Windows Registry, this isn't a reliable approach for 2 reasons.
1st reason: NOT all monitor names reflect the sizes, like "EPI EnVision EN-775e", what the hell is this size?
2nd reason: It's NOT easy to parse the name. Every naming convention differs among monitor vendors.

Best way:
You could use this tool: http://www.nirsoft.net/utils/dumpedid.zip (for Windows ONLY) to get EDID and diameter.
usage: DumpEDID.exe > YourFile.txt
or: DumpEDID.exe \\remote01 > YourFile.txt

Here's a typical output by DumpEDID.exe:
(NOTICE the text in RED)
************************************************************
Registry Key             : DISPLAY\DELD015\5&1f944c2&0&UID16777488
Monitor Name             : DELL E228WFP
Serial Number            : PN38083P0SVM
Manufacture Week         : 13 / 2008
ManufacturerID           : 44048 (0xAC10)
ProductID                : 53269 (0xD015)
Serial Number (Numeric)  : 810767949 (0x3053564D)
EDID Version             : 1.3
Display Gamma            : 2.20
Vertical Frequency       : 56 - 75 Hz
Horizontal Frequency     : 30 - 83 KHz
Image Size               : 47.3 X 29.6 cm (22.0 Inch)
Maximum Image Size       : 47 X 30 cm (22.0 Inch)
Maximum Resolution       : 1280 X 1024
Support Standby Mode     : Yes
Support Suspend Mode     : Yes
Support Low-Power Mode   : Yes
Support Default GTF      : No
Digital                  : Yes

Supported Display Modes  :

     720 X  400  70 Hz
     640 X  480  60 Hz
     640 X  480  75 Hz
     800 X  600  60 Hz
     800 X  600  75 Hz
    1024 X  768  60 Hz
    1024 X  768  75 Hz
    1280 X 1024  75 Hz
    1152 X  864  75 Hz
    1280 X 1024  60 Hz

************************************************************

Sometimes we'll get diameters like 18.9 Inch or 17.1 Inch. It's not a big problem, I believe you know the right thing to do. ^ _ ^.
.
.

[ Last edited by azziporah on 2009-12-2 at 08:59 ]
作者: xuantian     时间: 2009-12-7 16:21
楼上的东东不错,可惜使用宽屏后才知道使用宽屏很痛苦:)
作者: chishingchan     时间: 2009-12-9 01:13
对于我的10.2英寸的本本没效,显示是142英寸。支持的分辨率是空的。