本帖最后由 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
|