还是读分辨率的问题,谁知道@DesktopWidth,@DesktopHeight 的原理是什么?[已解决]
本帖最后由 jiandanai121 于 2011-8-16 13:04 编辑谁知道@DesktopWidth,@DesktopHeight 的原理是什么?为什么有的电脑读的没问题,有的电脑改成800*600了读出来还是1024*768?跟电脑的驱动有关系吗? 怎么没人回答?大家来帮帮忙啊。。。急求答案。。。。。。。。 在线急等啊。。。。。。 本帖最后由 水木子 于 2011-8-15 22:40 编辑
Local $hWin = DllCall('User32.dll', 'hwnd', 'GetDesktopWindow')
If Not @error Then
$aWinSize = WinGetClientSize($hWin)
MsgBox(0, '', $aWinSize & ' * ' & $aWinSize)
EndIf 学习过......... 自己看吧:http://msdn.microsoft.com/en-us/library/dd162611%28v=vs.85%29.aspx 用水哥的方法试试! 谢谢大家!!! 本帖最后由 happytc 于 2011-8-16 10:53 编辑
对了,最近我在Live capture关于双显示器截屏用到的一个函数
你可参考一下
#include <Array.au3>
Local $aCoord
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;char DeviceString;dword StateFlags;char DeviceID;char DeviceKey"
$tag_POINTL = "long x;long y"
$tag_DEVMOD = "char dmDeviceName;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;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 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) Or $aCoord > DllStructGetData($DevMod, "x") Then $aCoord = DllStructGetData($DevMod, "x")
If Not IsNumber($aCoord) Or $aCoord > DllStructGetData($DevMod, "y") Then $aCoord = DllStructGetData($DevMod, "y")
If Not IsNumber($aCoord) Or $aCoord < DllStructGetData($DevMod, "x") + DllStructGetData($DevMod, "dmPelsWidth") Then $aCoord = DllStructGetData($DevMod, "x") + DllStructGetData($DevMod, "dmPelsWidth")
If Not IsNumber($aCoord) Or $aCoord < DllStructGetData($DevMod, "y") + DllStructGetData($DevMod, "dmPelsHeight") Then $aCoord = DllStructGetData($DevMod, "y") + DllStructGetData($DevMod, "dmPelsHeight")
EndIf
$i += 1
WEnd
EndFunc
回复 9# happytc
这里随便诟病下au3关于结构体的定义,赋值,调用,就是麻烦两个字!
真是人为增加麻烦,不但写起来麻烦,看起来麻烦,理解起来同样麻烦。远不如C里的直观 看了九楼的 评点 我有点怕,,,我怕浪费时间在这个脚本上...
页:
[1]