找回密码
 加入
搜索
查看: 3346|回复: 10

[AU3基础] 还是读分辨率的问题,谁知道@DesktopWidth,@DesktopHeight 的原理是什么?[已解决]

  [复制链接]
发表于 2011-8-15 19:46:22 | 显示全部楼层 |阅读模式
本帖最后由 jiandanai121 于 2011-8-16 13:04 编辑

谁知道@DesktopWidth,@DesktopHeight 的原理是什么?为什么有的电脑读的没问题,有的电脑改成800*600了读出来还是1024*768?跟电脑的驱动有关系吗?
 楼主| 发表于 2011-8-15 19:55:46 | 显示全部楼层
怎么没人回答?大家来帮帮忙啊。。。急求答案。。。。。。。。
 楼主| 发表于 2011-8-15 21:11:41 | 显示全部楼层
在线急等啊。。。。。。
发表于 2011-8-15 22:39:09 | 显示全部楼层
本帖最后由 水木子 于 2011-8-15 22:40 编辑

Local $hWin = DllCall('User32.dll', 'hwnd', 'GetDesktopWindow')
If Not @error Then
        $aWinSize = WinGetClientSize($hWin[0])
        MsgBox(0, '', $aWinSize[0] & ' * ' & $aWinSize[1])
EndIf
发表于 2011-8-15 22:48:54 | 显示全部楼层
学习过.........
发表于 2011-8-15 22:57:19 | 显示全部楼层
发表于 2011-8-16 09:14:43 | 显示全部楼层
用水哥的方法试试!
 楼主| 发表于 2011-8-16 10:27:03 | 显示全部楼层
谢谢大家!!!
发表于 2011-8-16 10:52:38 | 显示全部楼层
本帖最后由 happytc 于 2011-8-16 10:53 编辑

对了,最近我在Live capture关于双显示器截屏用到的一个函数
你可参考一下

#include <Array.au3>

Local $aCoord[5]
MultiMonitor($aCoord)
_ArrayDisplay($aCoord)

Func MultiMonitor(ByRef $aCoord)        
        Local Const $DISPLAY_DEVICE_MIRRORING_DRIVER = 0x00000008, $DISPLAY_DEVICE_PRIMARY_DEVICE = 0x00000004, $ENUM_CURRENT_SETTINGS = -1        
        Local $tag_DISPLAY_DEVICE, $tag_POINTL, $tag_DEVMOD
        Local $tStruct, $aRet, $DevMod, $i = 0
        
        $tag_DISPLAY_DEVICE = "dword cb;char DeviceName[32];char DeviceString[128];dword StateFlags;char DeviceID[128];char DeviceKey[128]"
        $tag_POINTL = "long x;long y"
        $tag_DEVMOD = "char dmDeviceName[32];ushort dmSpecVersion;ushort dmDriverVersion;short dmSize;" & _
                        "ushort dmDriverExtra;dword dmFields;" & $tag_POINTL & ";dword dmDisplayOrientation;dword dmDisplayFixedOutput;" & _
                        "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _
                        "byte dmFormName[32];ushort LogPixels;dword dmBitsPerPel;int dmPelsWidth;dword dmPelsHeight;" & _
                        "dword dmDisplayFlags;dword dmDisplayFrequency"

        While True
                $tStruct = DllStructCreate($tag_DISPLAY_DEVICE)
                DllStructSetData($tStruct, "cb", DllStructGetSize($tStruct))

                $aRet = DllCall("user32.dll", "int", "EnumDisplayDevices", "ptr", 0, "dword", $i, "ptr", DllStructGetPtr($tStruct), "dword", 0)
                If Not $aRet[0] Then ExitLoop

                If Not BitAND(DllStructGetData($tStruct, "StateFlags"), $DISPLAY_DEVICE_MIRRORING_DRIVER) Then 
                        $DevMod = DllStructCreate($tag_DEVMOD)
                        DllStructSetData($DevMod, "dmSize", DllStructGetSize($DevMod))
                        $aRet = DllCall("user32.dll", "int", "EnumDisplaySettings", "str", DllStructGetData($tStruct, "DeviceName"), "dword", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($DevMod))

                        If Not IsNumber($aCoord[1]) Or $aCoord[1] > DllStructGetData($DevMod, "x") Then $aCoord[1] = DllStructGetData($DevMod, "x")
                        If Not IsNumber($aCoord[2]) Or $aCoord[2] > DllStructGetData($DevMod, "y") Then $aCoord[2] = DllStructGetData($DevMod, "y")
                        If Not IsNumber($aCoord[3]) Or $aCoord[3] < DllStructGetData($DevMod, "x") + DllStructGetData($DevMod, "dmPelsWidth") Then $aCoord[3] = DllStructGetData($DevMod, "x") + DllStructGetData($DevMod, "dmPelsWidth")
                        If Not IsNumber($aCoord[4]) Or $aCoord[4] < DllStructGetData($DevMod, "y") + DllStructGetData($DevMod, "dmPelsHeight") Then $aCoord[4] = DllStructGetData($DevMod, "y") + DllStructGetData($DevMod, "dmPelsHeight")
                EndIf
                $i += 1
        WEnd
EndFunc
发表于 2011-8-16 10:56:30 | 显示全部楼层
回复 9# happytc


    这里随便诟病下au3关于结构体的定义,赋值,调用,就是麻烦两个字!
真是人为增加麻烦,不但写起来麻烦,看起来麻烦,理解起来同样麻烦。远不如C里的直观
发表于 2015-7-15 22:41:22 | 显示全部楼层
看了九楼的 评点 我有点怕,,,我怕浪费时间在这个脚本上...
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 18:22 , Processed in 0.075087 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表