Jump to content

Program ScreenCaptureEx


wolf9228
 Share

Recommended Posts

This program allows to capture the screen through three methods

1 - Select area by mouse

2 - Select Automatic

3 - Capture all child windows

ScreenCaptureEx

ScreenCaptureEx.zip

NewScreenCaptureEx

The code has been modified

NewScreenCaptureEx.zip

NewScreenCaptureEx.au3

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GDIPlus.au3>

Global $vChildWindwos = 0 , $CaptureTest = 0,$CapHHook = 0 , $MouseGui = 0,$RgnGui = 0
Global $TrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]") , $MouseHHook = 0,$MouseGui = 0
Global $ButtonWnd = WinGetHandle("[CLASS:Button]") , $CaptureMouseTest = 0
Global $START_X , $START_Y , $IMGE_L = 0 , $IMGE_T = 0,$IMGE_W = 0 , $IMGE_H = 0
Global $InitDir1 = @MyDocumentsDir , $InitDir2 = $InitDir1 , $InitDir3 = $InitDir1
Global $InitDir4 = $InitDir1 , $InitDir5 = $InitDir1 , $InitDir6 = $InitDir1
Global $InitDir7 = $InitDir1, $InitDir8 = $InitDir1,$Num1,$Num2,$Num3,$Num4,$Num5

$ScreenGui = GUICreate("ScreenCaptureEx",230,245,(@DesktopWidth / 2) - 115, (@DesktopHeight / 2) - 123)
GUISetBkColor(15790320)
GUICtrlCreateGroup("ScreenCapture", 10, 10, 210,225)
$Button_1 = GUICtrlCreateButton("Select area by mouse", 15, 35, 200 , 30)
$Button_2 = GUICtrlCreateButton("Select Automatic", 15, 70, 200 , 30)
$Button_3 = GUICtrlCreateButton("Capture all child windows", 15, 105, 200 , 30)
$Button_4 = GUICtrlCreateButton("Exit", 15, 140, 200 , 30)
$Checkbox1 = GUICtrlCreateCheckbox("Hide taskbar", 50, 175, 130, 30)
$Checkbox2 = GUICtrlCreateCheckbox("Capture by any key", 33, 200, 167, 30)
GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_1
$ShowTaskBar = Not(BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) == $GUI_CHECKED)
$MousehBitmap = Mouse_Capture($ScreenGui,$ShowTaskBar)
if Not @error Then SaveImage($MousehBitmap)
GUISetState(@SW_SHOW,$ScreenGui)
GUISwitch($ScreenGui)
Case $msg = $Button_2
Dim $AutohBitmap = 0
$ShowTaskBar = Not(BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) == $GUI_CHECKED)
If BitAND(GUICtrlRead($Checkbox2),$GUI_CHECKED) = $GUI_CHECKED Then
$AutohBitmap = AutoCapture($ScreenGui,1,$ShowTaskBar)
Else
$AutohBitmap = AutoCapture($ScreenGui,0,$ShowTaskBar)
EndIf
if Not @error Then SaveImage($AutohBitmap)
GUISetState(@SW_SHOW,$ScreenGui)
GUISwitch($ScreenGui)
Case $msg = $Button_3
$ShowTaskBar = Not(BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) == $GUI_CHECKED)
If BitAND(GUICtrlRead($Checkbox2),$GUI_CHECKED) = $GUI_CHECKED Then
$ImageArray = ChildsCapture($ScreenGui,1,$ShowTaskBar)
Else
$ImageArray = ChildsCapture($ScreenGui,0,$ShowTaskBar)
EndIf
if Not @error Then ChildsSaveImage($ImageArray)
GUISetState(@SW_SHOW,$ScreenGui)
GUISwitch($ScreenGui)
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_4
Exit
EndSelect
WEnd

Func ChildsSaveImage($ImageArray)
Local $Save_Error = 1 , $ImageExit  = ""
$SGui = GUICreate("Save",310,100,(@DesktopWidth - 155) / 2, (@DesktopHeight - 50) / 2)
GUISetBkColor(15790320)
GUICtrlCreateGroup("Save Image", 10, 10, 280, 80)
$SButton_1 = GUICtrlCreateButton("BMP", 15, 33, 50 , 50)
$SButton_2 = GUICtrlCreateButton("PNG", 70, 33, 50 , 50)
$SButton_3 = GUICtrlCreateButton("GIF", 125, 33, 50 , 50)
$SButton_4 = GUICtrlCreateButton("JPG", 180, 33, 50 , 50)
$SButton_5 = GUICtrlCreateButton("Skip", 235, 33, 50 , 50)
GUISetState(@SW_SHOW,$SGui)
GUISwitch($SGui)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $SButton_1
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir5)
$Save_Error = @error
If Not($Save_Error) Then
$InitDir5 = $var
$ImageExit = ".BMP"
ExitLoop
EndIf
Case $msg = $SButton_2
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir6)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir6 = $var
$ImageExit = ".PNG"
ExitLoop
EndIf
Case $msg = $SButton_3
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir7)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir7 = $var
$ImageExit = ".GIF"
ExitLoop
EndIf
Case $msg = $SButton_4
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir8)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir8 = $var
$ImageExit = ".JPG"
ExitLoop
EndIf
Case $msg = $SButton_5
ExitLoop
EndSelect
WEnd
GUIDelete($SGui)
if Not($Save_Error) Then
_GDIPlus_Startup ()
For $i = 0 To UBound($ImageArray) - 1
$hBmp = $ImageArray[$i]
if ($hBmp) Then
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
_GDIPlus_ImageSaveToFile($hBitmap,$var & "\" & String($hBmp & $ImageExit))
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteObject($hBmp)
EndIf
Next
_GDIPlus_ShutDown ()
Else
For $i = 0 To UBound($ImageArray) - 1
$hBmp = $ImageArray[$i]
if ($hBmp) Then _WinAPI_DeleteObject($hBmp)
Next
EndIf
EndFunc

Func SaveImage($hBmp)
Local $Save_Error = 1
$SGui = GUICreate("Save",310,100,(@DesktopWidth - 155) / 2, (@DesktopHeight - 50) / 2)
GUISetBkColor(15790320)
GUICtrlCreateGroup("Save Image", 10, 10, 280, 80)
$SButton_1 = GUICtrlCreateButton("BMP", 15, 33, 50 , 50)
$SButton_2 = GUICtrlCreateButton("PNG", 70, 33, 50 , 50)
$SButton_3 = GUICtrlCreateButton("GIF", 125, 33, 50 , 50)
$SButton_4 = GUICtrlCreateButton("JPG", 180, 33, 50 , 50)
$SButton_5 = GUICtrlCreateButton("Skip", 235, 33, 50 , 50)
GUISetState(@SW_SHOW,$SGui)
GUISwitch($SGui)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $SButton_1
$var = FileSaveDialog("Choose a name.",$InitDir1,"IMAGE(*.BMP)",2,"Untitled" & $Num1,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir1 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir1 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".BMP" Then $var &= ".BMP"
$Num1 += 1
ExitLoop
EndIf
Case $msg = $SButton_2
$var = FileSaveDialog("Choose a name.",$InitDir2,"IMAGE(*.PNG)",2,"Untitled" & $Num2,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir2 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir2 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".PNG" Then $var &= ".PNG"
$Num2 += 1
ExitLoop
EndIf
Case $msg = $SButton_3
$var = FileSaveDialog("Choose a name.",$InitDir3,"IMAGE(*.GIF)",2,"Untitled" & $Num3,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir3 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir3 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".GIF" Then $var &= ".GIF"
$Num3 += 1
ExitLoop
EndIf
Case $msg = $SButton_4
$var = FileSaveDialog("Choose a name.",$InitDir4,"IMAGE(*.JPG)",2,"Untitled" & $Num4,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir4 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir4 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".JPG" Then $var &= ".JPG"
$Num4 += 1
ExitLoop
EndIf
Case $msg = $SButton_5
ExitLoop
EndSelect
WEnd
GUIDelete($SGui)
if Not($Save_Error) Then
if ($hBmp) Then
_GDIPlus_Startup ()
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
_GDIPlus_ImageSaveToFile($hBitmap,$var)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_ShutDown ()
_WinAPI_DeleteObject($hBmp)
EndIf
Else
if ($hBmp) Then _WinAPI_DeleteObject($hBmp)
EndIf
GUISwitch($SGui)
EndFunc

Func Mouse_Capture($DialogWin,$ShowTaskBar = True)
If Not($ShowTaskBar) Then ShowTaskBar(False)
if ($DialogWin) Then
$Return = GUISetState(@SW_HIDE,$DialogWin)
if ($Return = 0) Then Return SetError(1,0,0)
EndIf
$MouseGui = GUICreate("",0,0,0,0,BitOR($WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS) , _
BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE,$DS_MODALFRAME))
GUISetBkColor(0xFF0000,$MouseGui)
Local $HMod = _WinAPI_GetModuleHandle(0)
if ($HMod = 0) Then
GUIDelete($MouseGui)
Return SetError(2,0,0)
EndIf
$CaptureMouseTest = 0
$RegMouseProc = DllCallbackRegister("CaptureLowLevelMouseProc","long","int;wparam;lparam")
if ($RegMouseProc = 0) Then
GUIDelete($MouseGui)
Return SetError(3,0,0)
EndIf
$MouseHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegMouseProc),$HMod)
if ($MouseHHook = 0) Then
GUIDelete($MouseGui)
DllCallbackFree($RegMouseProc)
Return SetError(4,0,0)
EndIf
Local $hBmp = 0
While 1
if $CaptureMouseTest = 2 Then
GUIDelete($MouseGui)
_Sleep(300)
$hBmp = BitmapCreateFromPos($IMGE_L,$IMGE_T,$IMGE_W,$IMGE_H)
ExitLoop
EndIf
WEnd
If Not($ShowTaskBar) Then ShowTaskBar(True)
_WinAPI_UnhookWindowsHookEx($MouseHHook)
DllCallbackFree($RegMouseProc)
Return $hBmp
EndFunc


Func CaptureLowLevelMouseProc($nCode,$wParam,$lParam)
If $nCode < 0 Then _
Return _WinAPI_CallNextHookEx($MouseHHook, $nCode, $wParam, $lParam)

Select
Case $wParam == $WM_LBUTTONDOWN And $CaptureMouseTest = 0
$POINT = DllStructCreate($tagPOINT,$lParam)
$START_X =  DllStructGetData($POINT,1)
$START_Y =  DllStructGetData($POINT,2)
$CaptureMouseTest = 1
Return 1

Case $wParam == $WM_MOUSEMOVE And $CaptureMouseTest = 1
$POINT = DllStructCreate($tagPOINT,$lParam)
$MOVE_X = DllStructGetData($POINT,1)
$MOVE_Y = DllStructGetData($POINT,2)
if $START_X >= $MOVE_X Then
$L = $MOVE_X
$R = $START_X
Else
$R = $MOVE_X
$L = $START_X
EndIf
if $START_Y >= $MOVE_Y Then
$B = $START_Y
$T = $MOVE_Y
Else
$T = $START_Y
$B = $MOVE_Y
EndIf
Local $BorderSize = 3
$vL = ($L + $BorderSize)
$vT = ($T + $BorderSize)
$vR = ($R - $BorderSize)
$vB = ($B - $BorderSize)
$vW = ($vR - $vL)
$vH = ($vB - $vT)
Global $IMGE_L = $vL , $IMGE_T = $vT , $IMGE_W = $vW, $IMGE_H = $vH
MouseDrawGuiRgn($BorderSize,$L,$T,$R,$B)
Case $wParam == $WM_LBUTTONUP And $CaptureMouseTest = 1
$CaptureMouseTest = 2
Return 1
EndSelect

Return _WinAPI_CallNextHookEx($MouseHHook, $nCode, $wParam, $lParam)
EndFunc

Func MouseDrawGuiRgn($BorderSize,$L,$T,$R,$B)
Local $W = $R - $L , $H = $B - $T
Local $hREG1 = _WinAPI_CreateRectRgn(0,0,$W,$H)
Local $hREG2 = _WinAPI_CreateRectRgn($BorderSize,$BorderSize,($W - $BorderSize),($H - $BorderSize))
Local $hREG3 = _WinAPI_CreateRectRgn(0, 0, 0, 0)
_WinAPI_CombineRgn($hREG3,$hREG1,$hREG2,$RGN_DIFF)
_WinAPI_DeleteObject($hREG1)
_WinAPI_DeleteObject($hREG2)
_WinAPI_SetWindowRgn($MouseGui,$hREG3)
_WinAPI_DeleteObject($hREG3)
_WinAPI_SetWindowPos($MouseGui,0,$L,$T,$W,$H,BitOR($SWP_NOACTIVATE,$SWP_SHOWWINDOW))
EndFunc

Func ChildsCapture($DialogWin,$Flage = 0,$ShowTaskBar = True)
If Not($ShowTaskBar) Then ShowTaskBar(False)
if ($DialogWin) Then
$Return = GUISetState(@SW_HIDE,$DialogWin)
if ($Return = 0) Then Return SetError(1,0,0)
EndIf
Local $HMod = _WinAPI_GetModuleHandle(0)
if ($HMod = 0) Then Return SetError(2,0,0)
$CaptureTest = 0
Switch $Flage
Case 0
$RegProc = DllCallbackRegister("CaptureMouseProc","long","int;wparam;lparam")
if ($RegProc = 0) Then Return SetError(3,0,0)
$CapHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegProc),$HMod)
if ($CapHHook = 0) Then
DllCallbackFree($RegProc)
Return SetError(4,0,0)
EndIf
Case 1
$RegProc = DllCallbackRegister("CaptureKeyboardProc","long","int;wparam;lparam")
if ($RegProc = 0) Then Return SetError(5,0,0)
$CapHHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL,DllCallbackGetPtr($RegProc),$HMod)
if ($CapHHook = 0) Then
DllCallbackFree($RegProc)
Return SetError(6,0,0)
EndIf
Case Else
Return SetError(7,0,0)
EndSwitch
Local $hBmps = 0
While 1
$HwndsArray = WinFromPos()
if Not @error Then
$Windwo = $HwndsArray[0]
$RootOwner = $HwndsArray[1]
$IsChildWindo = $HwndsArray[2]
$ViewerSize = GetWindoViewerSize($RootOwner)
if Not @error Then
DrawGuiRgn($ViewerSize)
if ($CaptureTest) Then
if WinExists($RgnGui) Then
GUIDelete($RgnGui)
_Sleep(300)
EndIf
$ChildWindwos = GetChildWindows($RootOwner)
if IsArray($ChildWindwos) Then
Local $hBmps[UBound($ChildWindwos) + 1]
For $i = 0 To UBound($ChildWindwos) - 1
$ChildWindwo = $ChildWindwos[$i][0]
$iViewerSize = GetWindoViewerSize($ChildWindwo)
if Not @error Then
$L = $iViewerSize[0]
$T = $iViewerSize[1]
$R = $iViewerSize[2]
$B = $iViewerSize[3]
$W = $R - $L
$H = $B - $T
$hBmp = BitmapCreateFromPos($L,$T,$W,$H)
$hBmps[$i] = $hBmp
Else
$hBmps[$i] = 0
EndIf
Next
$L = $ViewerSize[0]
$T = $ViewerSize[1]
$R = $ViewerSize[2]
$B = $ViewerSize[3]
$W = $R - $L
$H = $B - $T
$hBmp = BitmapCreateFromPos($L,$T,$W,$H)
$hBmps[$i] = $hBmp
ExitLoop
Else
$L = $ViewerSize[0]
$T = $ViewerSize[1]
$R = $ViewerSize[2]
$B = $ViewerSize[3]
$W = $R - $L
$H = $B - $T
$hBmp = BitmapCreateFromPos($L,$T,$W,$H)
$hBmps[0] = $hBmp
ExitLoop
EndIf
EndIf
EndIf
EndIf
WEnd
If Not($ShowTaskBar) Then ShowTaskBar(True)
_WinAPI_UnhookWindowsHookEx($CapHHook)
DllCallbackFree($RegProc)
Return $hBmps
EndFunc

Func AutoCapture($DialogWin,$Flage = 0,$ShowTaskBar = True)
If Not($ShowTaskBar) Then ShowTaskBar(False)
if ($DialogWin) Then
$Return = GUISetState(@SW_HIDE,$DialogWin)
if ($Return = 0) Then Return SetError(1,0,0)
EndIf
Local $HMod = _WinAPI_GetModuleHandle(0)
if ($HMod = 0) Then Return SetError(2,0,0)
$CaptureTest = 0
Switch $Flage
Case 0
$RegProc = DllCallbackRegister("CaptureMouseProc","long","int;wparam;lparam")
if ($RegProc = 0) Then Return SetError(3,0,0)
$CapHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegProc),$HMod)
if ($CapHHook = 0) Then
DllCallbackFree($RegProc)
Return SetError(4,0,0)
EndIf
Case 1
$RegProc = DllCallbackRegister("CaptureKeyboardProc","long","int;wparam;lparam")
if ($RegProc = 0) Then Return SetError(5,0,0)
$CapHHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL,DllCallbackGetPtr($RegProc),$HMod)
if ($CapHHook = 0) Then
DllCallbackFree($RegProc)
Return SetError(6,0,0)
EndIf
Case Else
Return SetError(7,0,0)
EndSwitch
Local $hBmp = 0
While 1
$HwndsArray = WinFromPos()
if Not @error Then
$Windwo = $HwndsArray[0]
$RootOwner = $HwndsArray[1]
$IsChildWindo = $HwndsArray[2]
$ViewerSize = GetWindoViewerSize($Windwo)
if Not @error Then
DrawGuiRgn($ViewerSize)
if ($CaptureTest) Then
if WinExists($RgnGui) Then
GUIDelete($RgnGui)
_Sleep(300)
EndIf
Local $L = $ViewerSize[0], $T = $ViewerSize[1]
Local $R = $ViewerSize[2], $B = $ViewerSize[3]
Local $W = $R - $L , $H = $B - $T
$hBmp = BitmapCreateFromPos($L,$T,$W,$H)
ExitLoop
EndIf
EndIf
EndIf
WEnd
If Not($ShowTaskBar) Then ShowTaskBar(True)
_WinAPI_UnhookWindowsHookEx($CapHHook)
DllCallbackFree($RegProc)
Return $hBmp
EndFunc

Func DrawGuiRgn($ViewerSize)
if UBound($ViewerSize) < 4 Then Return False
Local $L = $ViewerSize[0], $T = $ViewerSize[1]
Local $R = $ViewerSize[2], $B = $ViewerSize[3]
$RgnGui = GUICreate("",0,0,0,0,BitOR($WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS) , _
BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE,$DS_MODALFRAME))
GUISetBkColor(0xFF0000,$RgnGui)
Local $W = $R - $L , $H = $B - $T
Local $hREG1 = _WinAPI_CreateRectRgn(0,0,$W,$H)
Local $hREG2 = _WinAPI_CreateRectRgn(4,4,$W - 4,$H - 4)
Local $hREG3 = _WinAPI_CreateRectRgn(0, 0, 0, 0)
_WinAPI_CombineRgn($hREG3,$hREG1,$hREG2,$RGN_DIFF)
_WinAPI_DeleteObject($hREG1)
_WinAPI_DeleteObject($hREG2)
_WinAPI_SetWindowRgn($RgnGui,$hREG3)
_WinAPI_DeleteObject($hREG3)
_Sleep(300)
_WinAPI_SetWindowPos($RgnGui,0,$L,$T,$W,$H,BitOR($SWP_NOACTIVATE,$SWP_SHOWWINDOW))
_Sleep(300)
GUIDelete($RgnGui)
_Sleep(300)
Return True
EndFunc

Func GetWindoViewerSize($Windwo)
$Rect = _WinAPI_GetWindowRect($Windwo)
if @error Then Return SetError(1,0,0)
Local $Left = DllStructGetData($Rect,1) , $Top = DllStructGetData($Rect,2)
Local $Right = DllStructGetData($Rect,3) , $Bottom = DllStructGetData($Rect,4)
Local $jRight = @DesktopWidth , $jBottom = @DesktopHeight
if $Bottom > $jBottom Then $Bottom = $jBottom
If $Right > $jRight Then $Right = $jRight
if $Left < 0 Then $Left = 0
if $Top < 0 Then $Top = 0
if ($Right - $Left) <= 0 Or ($Bottom - $Top) <= 0 Then Return SetError(2,0,0)
Local $IsChildWindwoOfTaskBar = False
$QChildWindwos = GetChildWindows($TrayWnd)
if Not IsArray($QChildWindwos) Then Return SetError(3,0,0)
For $i = 0 To UBound($QChildWindwos) - 1
if $QChildWindwos[$i][0] = $Windwo Then $IsChildWindwoOfTaskBar = True
Next
if (Not($IsChildWindwoOfTaskBar) And $Windwo <> $TrayWnd And $Windwo <> $ButtonWnd) Then
$Rect = _WinAPI_GetWindowRect($TrayWnd)
if @error Then Return SetError(4,0,0)
$iLeft = DllStructGetData($Rect,1)
$iTop = DllStructGetData($Rect,2)
$iRight = DllStructGetData($Rect,3)
$iBottom = DllStructGetData($Rect,4)
Select
Case $iLeft = 0 And $iBottom = @DesktopHeight And $iRight = @DesktopWidth
if ($Bottom > $iTop) Then $Bottom = $iTop
Case $iLeft = 0 And $iTop = 0 And $iRight = @DesktopWidth
if ($Top < $iBottom) Then $Top = $iBottom
Case $iLeft = 0 And $iTop = 0 And $iBottom = @DesktopHeight
if ($Left < $iRight) Then $Left = $iRight
Case $iTop = 0 And $iRight = @DesktopWidth And $iBottom = @DesktopHeight
if ($Right > $iLeft) Then $Right = $iLeft
EndSelect
if ($Right - $Left) <= 0 Or ($Bottom - $Top) <= 0 Then Return SetError(5,0,0)
EndIf
Local $ViewerSize[4]
$ViewerSize[0] = $Left
$ViewerSize[1] = $Top
$ViewerSize[2] = $Right
$ViewerSize[3] = $Bottom
Return $ViewerSize
EndFunc

Func CaptureMouseProc($nCode,$wParam,$lParam)
If $nCode < 0 Then _
Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam)
if ($wParam == $WM_LBUTTONDOWN And $CaptureTest = 0) Then
$CaptureTest = 1
Return 1
EndIf
if ($wParam == $WM_LBUTTONUP And $CaptureTest = 1) Then Return 1
Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam)
EndFunc

Func CaptureKeyboardProc($nCode,$wParam,$lParam)
If $nCode < 0 Then _
Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam)
if ($wParam = $WM_KEYDOWN And $CaptureTest = 0) Then
$CaptureTest = 1
Return 1
EndIf
if ($wParam == $WM_KEYUP And $CaptureTest = 1) Then Return 1
Return _WinAPI_CallNextHookEx($CapHHook, $nCode, $wParam, $lParam)
EndFunc

Func ShowTaskBar($BOOL)
if ($BOOL = True) Then
_WinAPI_ShowWindow($TrayWnd,@SW_SHOW)
if ($ButtonWnd) Then _WinAPI_ShowWindow($ButtonWnd,@SW_SHOW)
Else
_WinAPI_ShowWindow($TrayWnd,@SW_HIDE)
if ($ButtonWnd) Then _WinAPI_ShowWindow($ButtonWnd,@SW_HIDE)
EndIf
EndFunc

Func WinFromPos()
Local $MoPos = 0 , $HwndsArray[3]
While Not IsArray($MoPos)
$MoPos = MouseGetPos()
WEnd
$tPoint = DllStructCreate("int;int")
DllStructSetData($tPoint,1,$MoPos[0])
DllStructSetData($tPoint,2,$MoPos[1])
$PointHwnd = _WinAPI_WindowFromPoint($tPoint)
if ($PointHwnd = 0) Then Return SetError(1,0,0)
$RootOwner = _WinAPI_GetAncestor($PointHwnd,$GA_ROOTOWNER)
if ($RootOwner = 0) Then Return SetError(2,0,0)
$ChildWindwos = GetChildWindows($RootOwner)
if IsArray($ChildWindwos) Then
For $i = UBound($ChildWindwos) - 1 To 0 Step - 1
$ML = $MoPos[0]
$MT = $MoPos[1]
$ChildWindwo = $ChildWindwos[$i][0]
$L = $ChildWindwos[$i][1]
$T = $ChildWindwos[$i][2]
$W = $ChildWindwos[$i][3]
$H = $ChildWindwos[$i][4]
if ($ML >= $L ) And ($ML <= ($L + $W)) _
And ($MT >= $T ) And ($MT <= ($T + $H))  Then
$HwndsArray[0] = $ChildWindwo
$HwndsArray[1] = $RootOwner
$HwndsArray[2] = True ; IsChildWindo
Return $HwndsArray
EndIf
Next
EndIf
$HwndsArray[0] = $PointHwnd
$HwndsArray[1] = $RootOwner
$HwndsArray[2] = False ; IsChildWindo
Return $HwndsArray
EndFunc

Func GetChildWindows($HWND)
$vChildWindwos = 0
$RegChildProc = DLLCallbackRegister("EnumChildProc","int","hwnd;int")
$ChildProcPtr = DllCallbackGetPtr($RegChildProc)
DllCall("user32.dll","BOOL","EnumChildWindows","hwnd",$HWND,"ptr",$ChildProcPtr,"int",0)
DllCallbackFree($RegChildProc)
Return $vChildWindwos
EndFunc

Func EnumChildProc($HWND,$lParam)
Local $EndTest = False
For $i = 0 To UBound($vChildWindwos) - 1
if $HWND = $vChildWindwos[$i][0] Then $EndTest = True
Next
if $EndTest = False Then
if Not IsArray($vChildWindwos) Then
Dim $vChildWindwos[1][5]
Else
ReDim $vChildWindwos[UBound($vChildWindwos) + 1][5]
EndIf
$Rect = _WinAPI_GetWindowRect($HWND)
$Left = DllStructGetData($Rect,1)
$Top = DllStructGetData($Rect,2)
$Right = DllStructGetData($Rect,3)
$Bottom = DllStructGetData($Rect,4)
$L = $Left
$T = $Top
$W =  $Right - $Left
$H = $Bottom - $Top
$vChildWindwos[UBound($vChildWindwos) - 1][0] = $HWND
$vChildWindwos[UBound($vChildWindwos) - 1][1] = $L
$vChildWindwos[UBound($vChildWindwos) - 1][2] = $T
$vChildWindwos[UBound($vChildWindwos) - 1][3] = $W
$vChildWindwos[UBound($vChildWindwos) - 1][4] = $H
Return True
Else
Return False
EndIf
EndFunc

Func BitmapCreateFromPos($L,$T,$W,$H)
$DC = _WinAPI_GetWindowDC(0)
$CompatibleDC = _WinAPI_CreateCompatibleDC($DC)
$hBmp = _WinAPI_CreateCompatibleBitmap($DC,$W,$H)
_WinAPI_SelectObject($CompatibleDC,$hBmp)
_WinAPI_BitBlt($CompatibleDC,0,0,$W,$H,$DC,$L,$T,$SRCCOPY)
_WinAPI_ReleaseDC(0,$DC)
_WinAPI_DeleteDC($CompatibleDC)
Return $hBmp
EndFunc

Func _Sleep($Time)
Local $begin = TimerInit()
While TimerDiff($begin) < $Time
WEnd
EndFunc
Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Indeed a lot of good ideas.

Edit: I have to ask, was there a reason you stripped the UDF functions from the respective UDFs?

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

There are some bugs at least for me:

When I select "Select area by mouse" and move the retangle to my second monitor the retangle moves also!

When I select "Select Automatic" then the red retangle will not be deleted when mouse moves to another control area

Cannot capture on my second monitor.

Tested on Win7 x64 with Aero enabled.

Indeed, why did you include the functions from the UDFs instead of using "#include <...>"?

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Hi wolf9228

I have tried the 3 methods, first is ok, second is usefull for capture window as contextual menus :thumbsup:

but i can't get to work the third, in any format it returns an empty capture...

You can also add #Include <GDIPlus.au3> and suppress functions _WinAPI_CallNextHookEx to _WinAPI_SetWindowRgn

Despite these little glitches, thanks to share ;)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

That's the reason Obfuscator exists. Also you can probably appreciate that if the UDF is updated due to a memory leak your version won't be fixed, hence why it's good to link directly to the UDFs.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hi wolf9228

I have tried the 3 methods, first is ok, second is usefull for capture window as contextual menus :thumbsup:

but i can't get to work the third, in any format it returns an empty capture...

You can also add #Include <GDIPlus.au3> and suppress functions _WinAPI_CallNextHookEx to _WinAPI_SetWindowRgn

Despite these little glitches, thanks to share ;)

All methods work on my PC ...Maybe the third method does not work on your PC

due to a type Of graphics card

Another reason to not use the keyword included

Is the speed and efficiency of the program

Thank you

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Hi wolf9228

I have tried the 3 methods, first is ok, second is usefull for capture window as contextual menus :thumbsup:

but i can't get to work the third, in any format it returns an empty capture...

You can also add #Include <GDIPlus.au3> and suppress functions _WinAPI_CallNextHookEx to _WinAPI_SetWindowRgn

Despite these little glitches, thanks to share ;)

Try this script, maybe the problem WinAPI GetSystemMetrics function

Pending the outcome

Global $GUI_EVENT_CLOSE = -3 , $PS_SOLID = 0 , $AutoCaptureTest = False
Global $hPen = _WinAPI_CreatePen($PS_SOLID,4,0xFF) , $WH_MOUSE_LL = 14
Global $AuCapHHook = 0 ,$WM_LBUTTONDOWN = 0x0201,$WH_KEYBOARD_LL = 13,$GA_ROOT = 2
Global $WM_KEYDOWN = 0x0100 , $ChildArray = 0 , $GA_ROOTOWNER = 3 , $Desktop = 0
Global $RDW_INVALIDATE = 0x0001 , $RDW_ALLCHILDREN = 0x0080 , $SRCCOPY = 0x00CC0020
Global $InitDir1 = @MyDocumentsDir , $InitDir2 = $InitDir1 , $InitDir3 = $InitDir1
Global $InitDir4 = $InitDir1 , $InitDir5 = $InitDir1 , $InitDir6 = $InitDir1
Global $InitDir7 = $InitDir1, $InitDir8 = $InitDir1,$Num1,$Num2,$Num3,$Num4,$Num5
Global $giGDIPRef , $ghGDIPDll , $giGDIPToken , $GUI_CHECKED = 1 , $GA_PARENT = 1
Global $tagPOINT = "struct; long X;long Y; endstruct",$WM_MOUSEMOVE = 0x0200
Global $tagGDIPSTARTUPINPUT = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
Global $tagRECT = "struct; long Left;long Top;long Right;long Bottom; endstruct"
Global $tagGUID = "ulong Data1;ushort Data2;ushort Data3;byte Data4[8]"
Global $tagGDIPIMAGECODECINFO = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & _
"ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask"
Global $HideTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]"),$WS_POPUP = 0x80000000
Global $HideButton = WinGetHandle("[CLASS:Button]"),$MouseGui = 0,$WS_EX_WINDOWEDGE = 0x00000100
Global $WM_LBUTTON_TEST = 0,$IMGE_L = 0 , $IMGE_T = 0,$IMGE_W = 0 , $IMGE_H = 0,$MouseHHook = 0
Global $WS_BORDER = 0x00800000,$WS_CLIPSIBLINGS = 0x04000000,$WS_EX_TOPMOST = 0x00000008
Global $START_X , $START_Y ,$LF_RI_SIZE = 0 , $TO_BO_SIZE = 0,$WM_LBUTTONUP = 0x0202,$RGN_DIFF = 4
$ScreenGui = GUICreate("ScreenCaptureEx",230,245,(@DesktopWidth / 2) - 115, (@DesktopHeight / 2) - 250)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetBkColor(15790320)
GUICtrlCreateGroup("ScreenCapture", 10, 10, 210,225)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button_1 = GUICtrlCreateButton("Select area by mouse", 15, 35, 200 , 30)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button_2 = GUICtrlCreateButton("Select Automatic", 15, 70, 200 , 30)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button_3 = GUICtrlCreateButton("Capture all child windows", 15, 105, 200 , 30)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button_4 = GUICtrlCreateButton("Exit", 15, 140, 200 , 30)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox("Hide taskbar", 50, 175, 130, 30)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Checkbox2 = GUICtrlCreateCheckbox("Capture by any key", 33, 200, 167, 30)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_1
$MousehBitmap = Mouse_Capture($ScreenGui)
SaveImage($MousehBitmap)
GUISetState(@SW_SHOW,$ScreenGui)
GUISwitch($ScreenGui)
Case $msg = $Button_2
If BitAND(GUICtrlRead($Checkbox2),$GUI_CHECKED) = $GUI_CHECKED Then
AutoCapture($ScreenGui,1)
Else
AutoCapture($ScreenGui)
EndIf
Case $msg = $Button_3
If BitAND(GUICtrlRead($Checkbox2),$GUI_CHECKED) = $GUI_CHECKED Then
AllCapture($ScreenGui,1)
Else
AllCapture($ScreenGui)
EndIf
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_4
Exit
EndSelect
WEnd

Func Mouse_Capture($GUIX = 0,$BORDER_LF_RI_SIZE = 3,$BORDER_TO_BO_SIZE = 3,$BORDCOLOR = 0xFF0000)
$LF_RI_SIZE = $BORDER_LF_RI_SIZE ;Global $LF_RI_SIZE,$TO_BO_SIZE
$TO_BO_SIZE = $BORDER_TO_BO_SIZE ;Global $LF_RI_SIZE,$TO_BO_SIZE
If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED Then HIDETaskBar(0)
if $GUIX <> 0 Then GUISetState(@SW_HIDE ,$GUIX)
$MouseGui = GUICreate("", 1,1,1,1 ,BitOR($WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), _
BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GUISetBkColor($BORDCOLOR,$MouseGui)
$RegMouseProc = DllCallbackRegister("CaptureLowLevelMouseProc","long","int;wparam;lparam")
$HMod = _WinAPI_GetModuleHandle(0)
$MouseHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegMouseProc),$HMod)
While 1
if $WM_LBUTTON_TEST = 2 Then
$MousehBitmap = BitmapCreate()
_WinAPI_UnhookWindowsHookEx($MouseHHook)
DllCallbackFree($RegMouseProc)
$WM_LBUTTON_TEST = 0
If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED Then HIDETaskBar(1)
ExitLoop
EndIf
WEnd
Return $MousehBitmap
EndFunc

Func CaptureLowLevelMouseProc($nCode,$wParam,$lParam)
If $nCode < 0 Then _
Return _WinAPI_CallNextHookEx($MouseHHook, $nCode, $wParam, $lParam)

Select
Case $wParam == $WM_LBUTTONDOWN And $WM_LBUTTON_TEST = 0
$POINT = DllStructCreate($tagPOINT,$lParam)
$START_X =  DllStructGetData($POINT,1)
$START_Y =  DllStructGetData($POINT,2)
$WM_LBUTTON_TEST = 1
Return 1

Case $wParam == $WM_MOUSEMOVE And $WM_LBUTTON_TEST = 1
$POINT = DllStructCreate($tagPOINT,$lParam)
$MOVE_X = DllStructGetData($POINT,1)
$MOVE_Y = DllStructGetData($POINT,2)
if $START_X >= $MOVE_X Then
$L = $MOVE_X
$R = $START_X
Else
$R = $MOVE_X
$L = $START_X
EndIf
if $START_Y >= $MOVE_Y Then
$B = $START_Y
$T = $MOVE_Y
Else
$T = $START_Y
$B = $MOVE_Y
EndIf
$W = $R - $L
$H = $B - $T
;Global $IMGE_L = 0 , $IMGE_T = 0,$IMGE_W = 0 _$IMGE_H = 0
Global $IMGE_L = ($L + $LF_RI_SIZE),$IMGE_T = ($T + $TO_BO_SIZE),$IMGE_W = $W , $IMGE_H = $H
DrawGuiRgn($LF_RI_SIZE,$TO_BO_SIZE,$W,$H,$L,$T) ;Global $LF_RI_SIZE $TO_BO_SIZE
Case $wParam == $WM_LBUTTONUP And $WM_LBUTTON_TEST = 1
GUIDelete($MouseGui)
$WM_LBUTTON_TEST = 2
Return 1

EndSelect

Return _WinAPI_CallNextHookEx($MouseHHook, $nCode, $wParam, $lParam)
EndFunc


Func DrawGuiRgn($BORDER_LF_RI_SIZE,$BORDER_TO_BO_SIZE,$WIDTH,$HEIGHT,$LEFT,$TOP)
$W = $BORDER_LF_RI_SIZE * 2 + $WIDTH
$H = $BORDER_TO_BO_SIZE * 2 + $HEIGHT
_WinAPI_SetWindowPos($MouseGui,0,$LEFT,$TOP,$LEFT + $W,$TOP + $H,0)
Sleep(20)
$hREG1 = _WinAPI_CreateRectRgn(0,0,$W,$H)
$hREG2 = _WinAPI_CreateRectRgn($BORDER_LF_RI_SIZE,$BORDER_TO_BO_SIZE,$BORDER_LF_RI_SIZE + $WIDTH,$BORDER_TO_BO_SIZE + $HEIGHT)
$hREG3 = _WinAPI_CreateRectRgn(0, 0, 0, 0)
_WinAPI_CombineRgn($hREG3,$hREG1,$hREG2,$RGN_DIFF)
_WinAPI_DeleteObject($hREG1)
_WinAPI_DeleteObject($hREG2)
_WinAPI_SetWindowRgn($MouseGui,$hREG3)
_WinAPI_DeleteObject($hREG3)
GUISetState(@SW_SHOW,$MouseGui)
EndFunc

Func BitmapCreate()
;Global $IMGE_L = 0 , $IMGE_T = 0,$IMGE_W = 0 , $IMGE_H = 0
$DC = _WinAPI_GetDC(0)
$CompatibleDC = _WinAPI_CreateCompatibleDC($DC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($DC,$IMGE_W,$IMGE_H)
_WinAPI_SelectObject($CompatibleDC, $hBitmap)
_WinAPI_BitBlt($CompatibleDC,0,0,$IMGE_W,$IMGE_H,$DC,$IMGE_L,$IMGE_T,$SRCCOPY)
_WinAPI_ReleaseDC(0,$CompatibleDC)
_WinAPI_ReleaseDC(0,$DC)
Return $hBitmap
EndFunc


Func AutoCapture($Gui,$Flage = 0)
If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED Then HIDETaskBar(0)
GUISetState(@SW_HIDE,$Gui)
$AutoCaptureTest = 0
Local $HMod = _WinAPI_GetModuleHandle(0),$RegProc = 0
Switch $Flage
Case 0
$RegProc = DllCallbackRegister("AutoCaptureMouseProc","long","int;wparam;lparam")
$AuCapHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegProc),$HMod)
Case Else
$RegProc = DllCallbackRegister("AutoCaptureKeyboardProc","long","int;wparam;lparam")
$AuCapHHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL,DllCallbackGetPtr($RegProc),$HMod)
EndSwitch
While 1
Sleep(600)
WinAPI_RedrawWindow($Desktop)
Sleep(300)
$RtArray = WindowFromPoint()
if IsArray($RtArray) Then
$HWND = $RtArray[0]
$ROOT = $RtArray[1]
$IsChild = $RtArray[2]
if ($HWND) Then
$RECT = _WinAPI_GetWindowRect($HWND)
$Left = DllStructGetData($RECT,1)
$Top = DllStructGetData($RECT,2)
$Right = DllStructGetData($RECT,3)
$Bottom = DllStructGetData($RECT,4)
$jRight = @DesktopWidth
$jBottom = @DesktopHeight
if $Bottom > $jBottom Then $Bottom = $jBottom
If $Right > $jRight Then $Right = $jRight
if $Left < 0 Then $Left = 0
if $Top < 0 Then $Top = 0
if BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) <> $GUI_CHECKED Then
$ClassName = _WinAPI_GetClassName($HWND)
$BOOLA = IsChild($ROOT,$HWND)
$BOOLB = StringCompare($ClassName,"Button") <> 0 And StringCompare($ClassName,"Shell_TrayWnd") <> 0
if (($BOOLA) Or ($BOOLB)) Then
$Shell_TrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
$BOOL = IsChild($Shell_TrayWnd,$HWND)
if Not($BOOL) Then
$TrayWndRec = _WinAPI_GetWindowRect($Shell_TrayWnd)
$iLeft = DllStructGetData($TrayWndRec,1)
$iTop = DllStructGetData($TrayWndRec,2)
$iRight = DllStructGetData($TrayWndRec,3)
$iBottom = DllStructGetData($TrayWndRec,4)
Select
Case $iLeft = 0 And $iBottom = @DesktopHeight And $iRight = @DesktopWidth
if ($Bottom > $iTop) Then $Bottom = $iTop
Case $iLeft = 0 And $iTop = 0 And $iRight = @DesktopWidth
if ($Top < $iBottom) Then $Top = $iBottom
Case $iLeft = 0 And $iTop = 0 And $iBottom = @DesktopHeight
if ($Left < $iRight) Then $Left = $iRight
Case $iTop = 0 And $iRight = @DesktopWidth And $iBottom = @DesktopHeight
if ($Right > $iLeft) Then $Right = $iLeft
EndSelect
EndIf
EndIf
EndIf
$Desktop = _WinAPI_GetDesktopWindow()
$DesktophDC = _WinAPI_GetWindowDC($Desktop)
$obj_orig = _WinAPI_SelectObject($DesktophDC,$hPen)
_WinAPI_DrawLine($DesktophDC,$Left,$Top,$Right,$Top)
_WinAPI_DrawLine($DesktophDC,$Left,$Bottom,$Right,$Bottom)
_WinAPI_DrawLine($DesktophDC,$Left,$Top,$Left,$Bottom)
_WinAPI_DrawLine($DesktophDC,$Right,$Top,$Right,$Bottom)
_WinAPI_SelectObject($DesktophDC, $obj_orig)
_WinAPI_ReleaseDC($Desktop,$DesktophDC)
if ($AutoCaptureTest) Then
WinAPI_RedrawWindow($Desktop)
Sleep(300)
$RECT = _WinAPI_GetWindowRect($HWND)
$vLeft = DllStructGetData($RECT,1)
$vTop = DllStructGetData($RECT,2)
$vRight = DllStructGetData($RECT,3)
$vBottom = DllStructGetData($RECT,4)
$W = $Right - $Left
$H = $Bottom - $Top
$Left = $Left - $vLeft
$Top = $Top - $vTop
$hBitmap = BitmapCreateFromHWND($HWND,$Left,$Top,$W,$H)
If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED Then HIDETaskBar(1)
SaveImage($hBitmap)
ExitLoop
EndIf
EndIf
EndIf
WEnd
GUISetState(@SW_SHOW,$Gui)
GUISwitch($Gui)
_WinAPI_UnhookWindowsHookEx($AuCapHHook)
DllCallbackFree($RegProc)
EndFunc

Func AutoCaptureMouseProc($nCode,$wParam,$lParam)
If $nCode < 0 Then _
Return _WinAPI_CallNextHookEx($AuCapHHook, $nCode, $wParam, $lParam)
if ($wParam == $WM_LBUTTONDOWN And $AutoCaptureTest = 0) Then
$AutoCaptureTest = 1
Return 1
EndIf
Return _WinAPI_CallNextHookEx($AuCapHHook, $nCode, $wParam, $lParam)
EndFunc

Func AutoCaptureKeyboardProc($nCode,$wParam,$lParam)
If $nCode < 0 Then _
Return _WinAPI_CallNextHookEx($AuCapHHook, $nCode, $wParam, $lParam)
if ($wParam = $WM_KEYDOWN And $AutoCaptureTest = 0) Then
$AutoCaptureTest = 1
Return 1
EndIf
Return _WinAPI_CallNextHookEx($AuCapHHook, $nCode, $wParam, $lParam)
EndFunc

Func BitmapCreateFromHWND($HWND,$Left,$Top,$W,$H)
$DC = _WinAPI_GetWindowDC($HWND)
$CompatibleDC = _WinAPI_CreateCompatibleDC($DC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($DC,$W,$H)
_WinAPI_SelectObject($CompatibleDC,$hBitmap)
_WinAPI_BitBlt($CompatibleDC,0,0,$W,$H,$DC,$Left,$Top,$SRCCOPY)
_WinAPI_ReleaseDC($Desktop,$DC)
_WinAPI_ReleaseDC($Desktop,$CompatibleDC)
Return $hBitmap
EndFunc

Func AllCapture($Gui,$Flage = 0)
$Desktop = _WinAPI_GetDesktopWindow()
If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED Then HIDETaskBar(0)
GUISetState(@SW_HIDE,$Gui)
$AutoCaptureTest = 0
Local $HMod = _WinAPI_GetModuleHandle(0),$RegProc = 0
Switch $Flage
Case 0
$RegProc = DllCallbackRegister("AutoCaptureMouseProc","long","int;wparam;lparam")
$AuCapHHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL,DllCallbackGetPtr($RegProc),$HMod)
Case Else
$RegProc = DllCallbackRegister("AutoCaptureKeyboardProc","long","int;wparam;lparam")
$AuCapHHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL,DllCallbackGetPtr($RegProc),$HMod)
EndSwitch
While 1
Sleep(600)
WinAPI_RedrawWindow($Desktop)
Sleep(300)
$pos = MouseGetPos()
if IsArray($pos) Then
$FromPointHWND = WinAPIWindowFromPoint($pos[0],$pos[1])
$HWND = _WinAPI_GetAncestor($FromPointHWND,$GA_ROOTOWNER)
if ($HWND) Then
$RECT = _WinAPI_GetWindowRect($HWND)
$Left = DllStructGetData($RECT,1)
$Top = DllStructGetData($RECT,2)
$Right = DllStructGetData($RECT,3)
$Bottom = DllStructGetData($RECT,4)
$jRight = @DesktopWidth
$jBottom = @DesktopHeight
if $Bottom > $jBottom Then $Bottom = $jBottom
If $Right > $jRight Then $Right = $jRight
if $Left < 0 Then $Left = 0
if $Top < 0 Then $Top = 0
if BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) <> $GUI_CHECKED Then
$ClassName = _WinAPI_GetClassName($HWND)
$BOOLA = StringCompare($ClassName,"Button") <> 0 And StringCompare($ClassName,"Shell_TrayWnd") <> 0
if ($BOOLA) Then
$Shell_TrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
$BOOLB = IsChild($Shell_TrayWnd,$HWND)
if Not($BOOLB) Then
$TrayWndRec = _WinAPI_GetWindowRect($Shell_TrayWnd)
$iLeft = DllStructGetData($TrayWndRec,1)
$iTop = DllStructGetData($TrayWndRec,2)
$iRight = DllStructGetData($TrayWndRec,3)
$iBottom = DllStructGetData($TrayWndRec,4)
Select
Case $iLeft = 0 And $iBottom = @DesktopHeight And $iRight = @DesktopWidth
if ($Bottom > $iTop) Then $Bottom = $iTop
Case $iLeft = 0 And $iTop = 0 And $iRight = @DesktopWidth
if ($Top < $iBottom) Then $Top = $iBottom
Case $iLeft = 0 And $iTop = 0 And $iBottom = @DesktopHeight
if ($Left < $iRight) Then $Left = $iRight
Case $iTop = 0 And $iRight = @DesktopWidth And $iBottom = @DesktopHeight
if ($Right > $iLeft) Then $Right = $iLeft
EndSelect
EndIf
EndIf
EndIf
$DesktophDC = _WinAPI_GetWindowDC($Desktop)
$obj_orig = _WinAPI_SelectObject($DesktophDC,$hPen)
_WinAPI_DrawLine($DesktophDC,$Left,$Top,$Right,$Top)
_WinAPI_DrawLine($DesktophDC,$Left,$Bottom,$Right,$Bottom)
_WinAPI_DrawLine($DesktophDC,$Left,$Top,$Left,$Bottom)
_WinAPI_DrawLine($DesktophDC,$Right,$Top,$Right,$Bottom)
_WinAPI_SelectObject($DesktophDC, $obj_orig)
_WinAPI_ReleaseDC($Desktop,$DesktophDC)
if ($AutoCaptureTest) Then
$ROOT = _WinAPI_GetAncestor($HWND,$GA_ROOTOWNER)
$ChildArray = GetChildWindows($ROOT)
if Not IsArray($ChildArray) Then
If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED Then HIDETaskBar(1)
ExitLoop
EndIf
WinAPI_RedrawWindow($Desktop)
Sleep(300)
$ImageArray = BitmapCreateFromChildArray($HWND,$ChildArray)
If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED Then HIDETaskBar(1)
SaveImageAll($ImageArray)
ExitLoop
EndIf
EndIf
EndIf
WEnd
GUISetState(@SW_SHOW,$Gui)
GUISwitch($Gui)
_WinAPI_UnhookWindowsHookEx($AuCapHHook)
DllCallbackFree($RegProc)
EndFunc


Func BitmapCreateFromChildArray($GuiHWND,$ChildArray)
Local $ImageArray[UBound($ChildArray)][2]
For $i = 0 To UBound($ChildArray) - 1
$HWND = $ChildArray[$i][0]
$ImageArray[$i][1] = $HWND
$RECT = _WinAPI_GetWindowRect($HWND)
$Left = DllStructGetData($RECT,1)
$Top = DllStructGetData($RECT,2)
$Right = DllStructGetData($RECT,3)
$Bottom = DllStructGetData($RECT,4)
$jRight = @DesktopWidth
$jBottom = @DesktopHeight
if $Bottom > $jBottom Then $Bottom = $jBottom
If $Right > $jRight Then $Right = $jRight
if $Left < 0 Then $Left = 0
if $Top < 0 Then $Top = 0
if BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) <> $GUI_CHECKED Then
$ClassName = _WinAPI_GetClassName($HWND)
$BOOLA = DllCall("User32.dll","BOOL","IsChild","ptr",$GuiHWND,"ptr",$HWND)
$BOOLB = $ClassName <> "Button" And $ClassName <> "Shell_TrayWnd"
if ($BOOLB Or $BOOLA[0]) Then
$Shell_TrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
$BOOL = DllCall("User32.dll","BOOL","IsChild","ptr",$Shell_TrayWnd,"ptr",$HWND)
if ($BOOL[0] = 0) Then
$TrayWndRec = _WinAPI_GetWindowRect($Shell_TrayWnd)
$iLeft = DllStructGetData($TrayWndRec,1)
$iTop = DllStructGetData($TrayWndRec,2)
$iRight = DllStructGetData($TrayWndRec,3)
$iBottom = DllStructGetData($TrayWndRec,4)
Select
Case $iLeft = 0 And $iBottom = @DesktopHeight And $iRight = @DesktopWidth
if ($Bottom > $iTop) Then $Bottom = $iTop
Case $iLeft = 0 And $iTop = 0 And $iRight = @DesktopWidth
if ($Top < $iBottom) Then $Top = $iBottom
Case $iLeft = 0 And $iTop = 0 And $iBottom = @DesktopHeight
if ($Left < $iRight) Then $Left = $iRight
Case $iTop = 0 And $iRight = @DesktopWidth And $iBottom = @DesktopHeight
if ($Right > $iLeft) Then $Right = $iLeft
EndSelect
EndIf
EndIf
EndIf
$RECT = _WinAPI_GetWindowRect($HWND)
$vLeft = DllStructGetData($RECT,1)
$vTop = DllStructGetData($RECT,2)
$vRight = DllStructGetData($RECT,3)
$vBottom = DllStructGetData($RECT,4)
$W = $Right - $Left
$H = $Bottom - $Top
$Left = $Left - $vLeft
$Top = $Top - $vTop
$hBmp = BitmapCreateFromHWND($HWND,$Left,$Top,$W,$H)
$ImageArray[$i][0] = $hBmp
Next
Return $ImageArray
EndFunc

Func SaveImage($hBmp)
Local $Save_Error = 1
$SGui = GUICreate("Save",310,100,(@DesktopWidth - 155) / 2, (@DesktopHeight - 50) / 2)
GUISetBkColor(15790320)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("Save Image", 10, 10, 290, 80)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_1 = GUICtrlCreateButton("BMP", 15, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_2 = GUICtrlCreateButton("PNG", 70, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_3 = GUICtrlCreateButton("GIF", 125, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_4 = GUICtrlCreateButton("JPG", 185, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_5 = GUICtrlCreateButton("Skip", 245, 33, 50 , 50)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW,$SGui)
GUISwitch($SGui)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $SButton_1
$var = FileSaveDialog("Choose a name.",$InitDir1,"IMAGE(*.BMP)",2,"Untitled" & $Num1,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir1 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir1 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".BMP" Then $var &= ".BMP"
$Num1 += 1
ExitLoop
EndIf
Case $msg = $SButton_2
$var = FileSaveDialog("Choose a name.",$InitDir2,"IMAGE(*.PNG)",2,"Untitled" & $Num2,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir2 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir2 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".PNG" Then $var &= ".PNG"
$Num2 += 1
ExitLoop
EndIf
Case $msg = $SButton_3
$var = FileSaveDialog("Choose a name.",$InitDir3,"IMAGE(*.GIF)",2,"Untitled" & $Num3,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir3 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir3 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".GIF" Then $var &= ".GIF"
$Num3 += 1
ExitLoop
EndIf
Case $msg = $SButton_4
$var = FileSaveDialog("Choose a name.",$InitDir4,"IMAGE(*.JPG)",2,"Untitled" & $Num4,$SGui)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir4 = ""
$Split = StringSplit($var,"\")
For $J = 1 To $Split[0] - 1
$InitDir4 &= $Split[$J] & "\"
Next
If StringUpper(StringRight($var,4)) <> ".JPG" Then $var &= ".JPG"
$Num4 += 1
ExitLoop
EndIf
Case $msg = $SButton_5
ExitLoop
EndSelect
WEnd
GUIDelete($SGui)
if Not($Save_Error) Then
_GDIPlus_Startup ()
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
_GDIPlus_ImageSaveToFile($hBitmap,$var)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_ShutDown ()
_WinAPI_DeleteObject($hBmp)
Else
_WinAPI_DeleteObject($hBmp)
EndIf
GUISwitch($SGui)
EndFunc

Func SaveImageAll($ImageArray)
Local $Save_Error = 1 , $ImageExit  = ""
$SGui = GUICreate("Save",310,100,(@DesktopWidth - 155) / 2, (@DesktopHeight - 50) / 2)
GUISetBkColor(15790320)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("Save Image", 10, 10, 290, 80)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_1 = GUICtrlCreateButton("BMP", 15, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_2 = GUICtrlCreateButton("PNG", 70, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_3 = GUICtrlCreateButton("GIF", 125, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_4 = GUICtrlCreateButton("JPG", 185, 33, 50 , 50)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$SButton_5 = GUICtrlCreateButton("Skip", 245, 33, 50 , 50)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW,$SGui)
GUISwitch($SGui)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $SButton_1
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir5)
$Save_Error = @error
If Not($Save_Error) Then
$InitDir5 = $var
$ImageExit = ".BMP"
ExitLoop
EndIf
Case $msg = $SButton_2
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir6)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir6 = $var
$ImageExit = ".PNG"
ExitLoop
EndIf
Case $msg = $SButton_3
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir7)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir7 = $var
$ImageExit = ".GIF"
ExitLoop
EndIf
Case $msg = $SButton_4
$var = FileSelectFolder("Choose a folder.","",1 + 2 + 4,$InitDir8)
$Save_Error = @error
If Not ($Save_Error) Then
$InitDir8 = $var
$ImageExit = ".JPG"
ExitLoop
EndIf
Case $msg = $SButton_5
ExitLoop
EndSelect
WEnd
GUIDelete($SGui)
if Not($Save_Error) Then
_GDIPlus_Startup ()
For $i = 0 To UBound($ImageArray) - 1
$hBmp = $ImageArray[$i][0]
$HWND = $ImageArray[$i][1]
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
_GDIPlus_ImageSaveToFile($hBitmap,$var & "\" & String($HWND & $ImageExit))
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteObject($hBmp)
Next
_GDIPlus_ShutDown ()
Else
For $i = 0 To UBound($ImageArray) - 1
$hBmp = $ImageArray[$i][0]
_WinAPI_DeleteObject($hBmp)
Next
EndIf
EndFunc

Func WindowFromPoint()
$pos = MouseGetPos()
Local $RtArray[3]
if IsArray($pos) Then
$FromPointHWND = WinAPIWindowFromPoint($pos[0],$pos[1])
$ROOT = _WinAPI_GetAncestor($FromPointHWND,$GA_ROOTOWNER)
$ChildArray = GetChildWindows($ROOT)
For $i = UBound($ChildArray) - 1 To 0 Step - 1
$ML = $pos[0]
$MT = $pos[1]
$HWND = $ChildArray[$i][0]
$L = $ChildArray[$i][1]
$T = $ChildArray[$i][2]
$W = $ChildArray[$i][3]
$H = $ChildArray[$i][4]
if ($ML >= $L ) And ($ML <= ($L + $W)) _
And ($MT >= $T ) And ($MT <= ($T + $H))  Then
$RtArray[0] = $HWND
$RtArray[1] = $ROOT
$RtArray[2] = 1
Return $RtArray
EndIf
Next
$RtArray[0] = $FromPointHWND
$RtArray[1] = 0
$RtArray[2] = 0
Return $RtArray
EndIf
EndFunc

Func GetChildWindows($HWND)
$ChildArray = 0
Dim $ChildArray[1][5]
$RegChildProc = DLLCallbackRegister("EnumChildProc","int","hwnd;int")
$ChildProcPtr = DllCallbackGetPtr($RegChildProc)
$BOOL = DllCall("user32.dll","int","EnumChildWindows","hwnd",$HWND,"ptr",$ChildProcPtr,"int",0)
if UBound($ChildArray) > 1 Then ReDim $ChildArray[UBound($ChildArray) - 1][5]
DllCallbackFree($RegChildProc)
Return $ChildArray
EndFunc

Func EnumChildProc($HWND,$lParam)
Local $Test = False
For $i = 0 To UBound($ChildArray) - 1
if $HWND = $ChildArray[$i][0] Then $Test = True
Next
if $Test = False Then
$RECT = _WinAPI_GetWindowRect($HWND)
$Left = DllStructGetData($RECT,1)
$Top = DllStructGetData($RECT,2)
$Right = DllStructGetData($RECT,3)
$Bottom = DllStructGetData($RECT,4)
$L = $Left
$T = $Top
$W =  $Right - $Left
$H = $Bottom - $Top
$ChildArray[UBound($ChildArray) - 1][0] = $HWND
$ChildArray[UBound($ChildArray) - 1][1] = $L
$ChildArray[UBound($ChildArray) - 1][2] = $T
$ChildArray[UBound($ChildArray) - 1][3] = $W
$ChildArray[UBound($ChildArray) - 1][4] = $H
ReDim $ChildArray[UBound($ChildArray) + 1][5]
Return True
Else
Return False
EndIf
EndFunc

Func HIDETaskBar($Flag = 0)
if ($Flag = 0) Then
_WinAPI_ShowWindow($HideTrayWnd,@SW_HIDE)
_WinAPI_ShowWindow($HideButton,@SW_HIDE)
Else
_WinAPI_ShowWindow($HideTrayWnd,@SW_SHOW)
_WinAPI_ShowWindow($HideButton,@SW_SHOW)
EndIf
EndFunc

Func WinAPIWindowFromPoint($X,$Y)
$FromPointHWND = DllCall("User32.dll","HWND","WindowFromPoint","int",$X,"int",$Y)
if @error Then Return SetError(@error,@extended,0)
Return $FromPointHWND[0]
EndFunc

Func IsChild($hWndParent,$hWnd)
$BOOL = DllCall("User32.dll","BOOL","IsChild","ptr",$hWndParent,"ptr",$hWnd)
if @error Then Return SetError(@error,@extended,0)
Return $BOOL[0]
EndFunc

Func WinAPI_RedrawWindow($HWND)
_WinAPI_RedrawWindow($HWND, 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndFunc

Func _WinAPI_CallNextHookEx($hhk, $iCode, $wParam, $lParam)
    Local $aResult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhk, "int", $iCode, "wparam", $wParam, "lparam", $lParam)
    If @error Then Return SetError(@error, @extended, -1)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_CallNextHookEx

Func _WinAPI_SetWindowsHookEx($idHook, $lpfn, $hmod, $dwThreadId = 0)
    Local $aResult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $idHook, "ptr", $lpfn, "handle", $hmod, "dword", $dwThreadId)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;==>_

Func _WinAPI_GetModuleHandle($sModuleName)
    Local $sModuleNameType = "wstr"
    If $sModuleName = "" Then
        $sModuleName = 0
        $sModuleNameType = "ptr"
    EndIf
    Local $aResult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $sModuleNameType, $sModuleName)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_GetModuleHandle

Func _WinAPI_CreatePen($iPenStyle, $iWidth, $nColor)
    Local $aResult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $iPenStyle, "int", $iWidth, "dword", $nColor)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Func _WinAPI_RedrawWindow($hWnd, $tRect = 0, $hRegion = 0, $iFlags = 5)
    Local $aResult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hWnd, "struct*", $tRect, "handle", $hRegion, "uint", $iFlags)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_RedrawWindow

Func _WinAPI_GetAncestor($hWnd, $iFlags = 1)
    Local $aResult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hWnd, "uint", $iFlags)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;==>

Func _WinAPI_GetWindowRect($hWnd)
    Local $tRect = DllStructCreate($tagRECT)
    DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hWnd, "struct*", $tRect)
    If @error Then Return SetError(@error, @extended, 0)
    Return $tRect
EndFunc   ;=


Func _WinAPI_GetSystemMetrics($iIndex)
    Local $aResult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iIndex)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Func _WinAPI_GetClassName($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local $aResult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hWnd, "wstr", "", "int", 4096)
    If @error Then Return SetError(@error, @extended, False)
    Return SetExtended($aResult[0], $aResult[2])
EndFunc   ;=

Func _WinAPI_GetDesktopWindow()
    Local $aResult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;==

Func _WinAPI_GetWindowDC($hWnd)
    Local $aResult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hWnd)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_GetWindowDC

Func _WinAPI_SelectObject($hDC, $hGDIObj)
    Local $aResult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hDC, "handle", $hGDIObj)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_SelectObject

Func _WinAPI_DrawLine($hDC, $iX1, $iY1, $iX2, $iY2)
    _WinAPI_MoveTo($hDC, $iX1, $iY1)
    If @error Then Return SetError(@error, @extended, False)
    _WinAPI_LineTo($hDC, $iX2, $iY2)
    If @error Then Return SetError(@error, @extended, False)
    Return True
EndFunc   ;=

Func _WinAPI_MoveTo($hDC, $iX, $iY)
    Local $aResult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hDC, "int", $iX, "int", $iY, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;

Func _WinAPI_LineTo($hDC, $iX, $iY)
    Local $aResult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hDC, "int", $iX, "int", $iY)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_LineTo

Func _WinAPI_CreateCompatibleDC($hDC)
    Local $aResult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hDC)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Func _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
    Local $aResult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hDC, "int", $iWidth, "int", $iHeight)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Func _WinAPI_BitBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iROP)
    Local $aResult = DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _
            "handle", $hSrcDC, "int", $iXSrc, "int", $iYSrc, "dword", $iROP)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;=

Func _WinAPI_ReleaseDC($hWnd, $hDC)
    Local $aResult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "handle", $hDC)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc

Func _WinAPI_GetDC($hWnd)
    Local $aResult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hWnd)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;

Func _WinAPI_UnhookWindowsHookEx($hhk)
    Local $aResult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhk)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;=

Func _GDIPlus_Startup()
    $giGDIPRef += 1
    If $giGDIPRef > 1 Then Return True

    $ghGDIPDll = DllOpen("GDIPlus.dll")
    If $ghGDIPDll = -1 Then
        $giGDIPRef = 0
        Return SetError(1, 2, False)
    EndIf
    Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    Local $tToken = DllStructCreate("ulong_ptr Data")
    DllStructSetData($tInput, "Version", 1)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_Startup

Func _GDIPlus_BitmapCreateFromHBITMAP($hBmp, $hPal = 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromHBITMAP", "handle", $hBmp, "handle", $hPal, "ptr*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetExtended($aResult[0], $aResult[3])
EndFunc   ;==>_GDIPlus_BitmapCreateFromHBITMAP

Func _WinAPI_DeleteObject($hObject)
    Local $aResult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hObject)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>

Func _GDIPlus_Shutdown()
    If $ghGDIPDll = 0 Then Return SetError(-1, -1, False)

    $giGDIPRef -= 1
    If $giGDIPRef = 0 Then
        DllCall($ghGDIPDll, "none", "GdiplusShutdown", "ptr", $giGDIPToken)
        DllClose($ghGDIPDll)
        $ghGDIPDll = 0
    EndIf
    Return True
EndFunc   ;==>_GDIPlus_Shut

Func _GDIPlus_ImageSaveToFile($hImage, $sFileName)
    Local $sExt = __GDIPlus_ExtractFileExt($sFileName)
    Local $sCLSID = _GDIPlus_EncodersGetCLSID($sExt)
    If $sCLSID = "" Then Return SetError(-1, 0, False)
    Return _GDIPlus_ImageSaveToFileEx($hImage, $sFileName, $sCLSID, 0)
EndFunc   ;==>_GDIPlus


Func __GDIPlus_ExtractFileExt($sFileName, $fNoDot = True)
    Local $iIndex = __GDIPlus_LastDelimiter(".\:", $sFileName)
    If ($iIndex > 0) And (StringMid($sFileName, $iIndex, 1) = '.') Then
        If $fNoDot Then
            Return StringMid($sFileName, $iIndex + 1)
        Else
            Return StringMid($sFileName, $iIndex)
        EndIf
    Else
        Return ""
    EndIf
EndFunc   ;==>__GDIPlus_ExtractFileExt

Func __GDIPlus_LastDelimiter($sDelimiters, $sString)
    Local $sDelimiter, $iN

    For $iI = 1 To StringLen($sDelimiters)
        $sDelimiter = StringMid($sDelimiters, $iI, 1)
        $iN = StringInStr($sString, $sDelimiter, 0, -1)
        If $iN > 0 Then Return $iN
    Next
EndFunc   ;==>__GDIPlus_LastDelimiter

Func _GDIPlus_EncodersGetCLSID($sFileExt)
    Local $aEncoders = _GDIPlus_Encoders()
    For $iI = 1 To $aEncoders[0][0]
        If StringInStr($aEncoders[$iI][6], "*." & $sFileExt) > 0 Then Return $aEncoders[$iI][1]
    Next
    Return SetError(-1, -1, "")
EndFunc   ;==>_G

Func _GDIPlus_Encoders()
    Local $iCount = _GDIPlus_EncodersGetCount()
    Local $iSize = _GDIPlus_EncodersGetSize()
    Local $tBuffer = DllStructCreate("byte[" & $iSize & "]")
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageEncoders", "uint", $iCount, "uint", $iSize, "struct*", $tBuffer)
    If @error Then Return SetError(@error, @extended, 0)
    If $aResult[0] <> 0 Then Return SetError($aResult[0], 0, 0)

    Local $pBuffer = DllStructGetPtr($tBuffer)
    Local $tCodec, $aInfo[$iCount + 1][14]
    $aInfo[0][0] = $iCount
    For $iI = 1 To $iCount
        $tCodec = DllStructCreate($tagGDIPIMAGECODECINFO, $pBuffer)
        $aInfo[$iI][1] = _WinAPI_StringFromGUID(DllStructGetPtr($tCodec, "CLSID"))
        $aInfo[$iI][2] = _WinAPI_StringFromGUID(DllStructGetPtr($tCodec, "FormatID"))
        $aInfo[$iI][3] = _WinAPI_WideCharToMultiByte(DllStructGetData($tCodec, "CodecName"))
        $aInfo[$iI][4] = _WinAPI_WideCharToMultiByte(DllStructGetData($tCodec, "DllName"))
        $aInfo[$iI][5] = _WinAPI_WideCharToMultiByte(DllStructGetData($tCodec, "FormatDesc"))
        $aInfo[$iI][6] = _WinAPI_WideCharToMultiByte(DllStructGetData($tCodec, "FileExt"))
        $aInfo[$iI][7] = _WinAPI_WideCharToMultiByte(DllStructGetData($tCodec, "MimeType"))
        $aInfo[$iI][8] = DllStructGetData($tCodec, "Flags")
        $aInfo[$iI][9] = DllStructGetData($tCodec, "Version")
        $aInfo[$iI][10] = DllStructGetData($tCodec, "SigCount")
        $aInfo[$iI][11] = DllStructGetData($tCodec, "SigSize")
        $aInfo[$iI][12] = DllStructGetData($tCodec, "SigPattern")
        $aInfo[$iI][13] = DllStructGetData($tCodec, "SigMask")
        $pBuffer += DllStructGetSize($tCodec)
    Next
    Return $aInfo
EndFunc   ;==>_GDIPlus_Encoders


Func _GDIPlus_EncodersGetCount()
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0)
    If @error Then Return SetError(@error, @extended, -1)
    Return SetExtended($aResult[0], $aResult[1])
EndFunc   ;==>_GDIPlus_EncodersGetCount

Func _GDIPlus_ImageSaveToFileEx($hImage, $sFileName, $sEncoder, $pParams = 0)
    Local $tGUID = _WinAPI_GUIDFromString($sEncoder)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipSaveImageToFile", "handle", $hImage, "wstr", $sFileName, "struct*", $tGUID, "struct*", $pParams)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc   ;=

Func _WinAPI_GUIDFromString($sGUID)
    Local $tGUID = DllStructCreate($tagGUID)
    _WinAPI_GUIDFromStringEx($sGUID, $tGUID)
    If @error Then Return SetError(@error, @extended, 0)
    Return $tGUID
EndFunc   ;==>_WinAPI_GUIDFromString

Func _WinAPI_GUIDFromStringEx($sGUID, $pGUID)
    Local $aResult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $pGUID)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_GUIDFromStringEx

Func _WinAPI_StringFromGUID($pGUID)
    Local $aResult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $pGUID, "wstr", "", "int", 40)
    If @error Then Return SetError(@error, @extended, "")
    Return SetExtended($aResult[0], $aResult[2])
EndFunc   ;

Func _WinAPI_WideCharToMultiByte($pUnicode, $iCodePage = 0, $bRetString = True)
    Local $sUnicodeType = "wstr"
    If Not IsString($pUnicode) Then $sUnicodeType = "struct*"
    Local $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $iCodePage, "dword", 0, $sUnicodeType, $pUnicode, "int", -1, _
            "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
    If @error Then Return SetError(@error, @extended, "")

    Local $tMultiByte = DllStructCreate("char[" & $aResult[0] & "]")

    $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $iCodePage, "dword", 0, $sUnicodeType, $pUnicode, "int", -1, _
            "struct*", $tMultiByte, "int", $aResult[0], "ptr", 0, "ptr", 0)
    If @error Then Return SetError(@error, @extended, "")

    If $bRetString Then Return DllStructGetData($tMultiByte, 1)
    Return $tMultiByte
EndFunc   ;==>_WinAPI_WideCharToMultiByte

Func _GDIPlus_EncodersGetSize()
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0)
    If @error Then Return SetError(@error, @extended, -1)
    Return SetExtended($aResult[0], $aResult[2])
EndFunc   ;==>_GDIPlus_EncodersGetSize

Func _WinAPI_ShowWindow($hWnd, $iCmdShow = 5)
    Local $aResult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hWnd, "int", $iCmdShow)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_ShowWindow

Func _WinAPI_GetWindow($hWnd, $iCmd)
    Local $aResult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hWnd, "uint", $iCmd)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_GetWindow


Func _WinAPI_ScreenToClient($hWnd, ByRef $tPoint)
    Local $aResult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hWnd, "struct*", $tPoint)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_ScreenToClient

Func _WinAPI_SetWindowPos($hWnd, $hAfter, $iX, $iY, $iCX, $iCY, $iFlags)
    Local $aResult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hWnd, "hwnd", $hAfter, "int", $iX, "int", $iY, "int", $iCX, _
            "int", $iCY, "uint", $iFlags)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_SetWindowPos

Func _WinAPI_CreateRectRgn($iLeftRect, $iTopRect, $iRightRect, $iBottomRect)
    Local $aResult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $iLeftRect, "int", $iTopRect, "int", $iRightRect, "int", $iBottomRect)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Func _WinAPI_CombineRgn($hRgnDest, $hRgnSrc1, $hRgnSrc2, $iCombineMode)
    Local $aResult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hRgnDest, "handle", $hRgnSrc1, "handle", $hRgnSrc2, "int", $iCombineMode)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_CombineRgn

Func _WinAPI_SetWindowRgn($hWnd, $hRgn, $bRedraw = True)
    Local $aResult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hWnd, "handle", $hRgn, "bool", $bRedraw)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_SetWindowRgn

صرح السماء كان هنا

 

Link to comment
Share on other sites

  • 2 weeks later...

There are some bugs at least for me:

When I select "Select area by mouse" and move the retangle to my second monitor the retangle moves also!

When I select "Select Automatic" then the red retangle will not be deleted when mouse moves to another control area

Cannot capture on my second monitor.

Tested on Win7 x64 with Aero enabled.

Indeed, why did you include the functions from the UDFs instead of using "#include <...>"?

Br,

UEZ

Try the script now

صرح السماء كان هنا

 

Link to comment
Share on other sites

Hi wolf9228

I have tried the 3 methods, first is ok, second is usefull for capture window as contextual menus :thumbsup:

but i can't get to work the third, in any format it returns an empty capture...

You can also add #Include <GDIPlus.au3> and suppress functions _WinAPI_CallNextHookEx to _WinAPI_SetWindowRgn

Despite these little glitches, thanks to share ;)

Try the script now

صرح السماء كان هنا

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...