XpycTMD
Цитата:
[more=Можно]
Код: #include <GuiConstants.au3>
#include <ScreenCapture.au3>
HotKeySet("{ESC}", "QuitApp")
Global $IsSelectingBegin = False
Global $aMouse_Cooords[2]
$GUI = GUICreate("Capture Selected Area - Demo", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
WinSetTrans($GUI, "", 100)
$ListView = GUICtrlCreateListView("", 0, 0, @DesktopWidth, @DesktopHeight, 0)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState()
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE Or IsArray($aMouse_Cooords[1])
GUIDelete($GUI)
WinWaitClose($GUI)
$aStart_Coords = $aMouse_Cooords[0]
$aEnd_Coords = $aMouse_Cooords[1]
$Left_Pos = $aStart_Coords[0]
$Right_Pos = $aEnd_Coords[0]
If $Left_Pos > $Right_Pos Then
$Left_Pos = $aEnd_Coords[0]
$Right_Pos = $aStart_Coords[0]
EndIf
$Top_Pos = $aStart_Coords[1]
$Bottom_Pos = $aEnd_Coords[1]
If $Top_Pos > $Bottom_Pos Then
$Top_Pos = $aEnd_Coords[1]
$Bottom_Pos = $aStart_Coords[1]
EndIf
$sFileName = FileSaveDialog("Save Capture As...", "", "PNG Image (*.png)", 18, "Captured Image")
If @error Then Exit
If StringRight($sFileName, 4) <> ".png" Then $sFileName &= ".png"
_ScreenCapture_Capture($sFileName, $Left_Pos-6, $Top_Pos-5, $Right_Pos+2, $Bottom_Pos+2, False)
Exit
EndSelect
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView = $ListView
If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_MARQUEEBEGIN
$IsSelectingBegin = True
$aMouse_Cooords[0] = MouseGetPos()
Case $NM_RELEASEDCAPTURE
If $IsSelectingBegin Then $aMouse_Cooords[1] = MouseGetPos()
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Func QuitApp()
Exit
EndFunc
Цитата:
молжно ли сделать скриншот не всего экрана а только определенных координат???
[more=Можно]
Код: #include <GuiConstants.au3>
#include <ScreenCapture.au3>
HotKeySet("{ESC}", "QuitApp")
Global $IsSelectingBegin = False
Global $aMouse_Cooords[2]
$GUI = GUICreate("Capture Selected Area - Demo", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
WinSetTrans($GUI, "", 100)
$ListView = GUICtrlCreateListView("", 0, 0, @DesktopWidth, @DesktopHeight, 0)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState()
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE Or IsArray($aMouse_Cooords[1])
GUIDelete($GUI)
WinWaitClose($GUI)
$aStart_Coords = $aMouse_Cooords[0]
$aEnd_Coords = $aMouse_Cooords[1]
$Left_Pos = $aStart_Coords[0]
$Right_Pos = $aEnd_Coords[0]
If $Left_Pos > $Right_Pos Then
$Left_Pos = $aEnd_Coords[0]
$Right_Pos = $aStart_Coords[0]
EndIf
$Top_Pos = $aStart_Coords[1]
$Bottom_Pos = $aEnd_Coords[1]
If $Top_Pos > $Bottom_Pos Then
$Top_Pos = $aEnd_Coords[1]
$Bottom_Pos = $aStart_Coords[1]
EndIf
$sFileName = FileSaveDialog("Save Capture As...", "", "PNG Image (*.png)", 18, "Captured Image")
If @error Then Exit
If StringRight($sFileName, 4) <> ".png" Then $sFileName &= ".png"
_ScreenCapture_Capture($sFileName, $Left_Pos-6, $Top_Pos-5, $Right_Pos+2, $Bottom_Pos+2, False)
Exit
EndSelect
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView = $ListView
If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_MARQUEEBEGIN
$IsSelectingBegin = True
$aMouse_Cooords[0] = MouseGetPos()
Case $NM_RELEASEDCAPTURE
If $IsSelectingBegin Then $aMouse_Cooords[1] = MouseGetPos()
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Func QuitApp()
Exit
EndFunc