Hi,
habe die Lupenfunktion entdeckt. Sie wurde in älteren Posts mehrfach erwähnt.
Wie bekomme ich es hin, dass der Ausschnitt nicht mehr flimmert?
Außerdem stimmt der Ausschnitt nicht zu dem tatsächlichen ausgewählten auf dem Desktop (nur minimal Unterschiede)
Gut wäre noch, wenn das Vorschaufenster nicht unten aus dem Bildschirm verschwindet
Spoiler anzeigen
#include<GUIConstants.au3>
#include<Misc.au3>
Dim $left, $top, $width, $height, $MyhWnd
[/autoit] [autoit][/autoit] [autoit]_auswahl()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit];********************************************
; Auswahl (nur für Bereich) *
;********************************************
Func _auswahl()
Global $left, $top, $width, $height
$AuswahlGUI = GUICreate("ScreenShot", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)); erstellen eines GUI-Fensters
GUISetCursor(3, 1, $AuswahlGUI); Mouse-Cursor umschalten, Kreuz
GUISetState(); öffnen des GUI-Fensters
WinSetTrans("ScreenShot", "", 20)
Local $UserDLL = DllOpen("user32.dll"); öffnen der User32.dll
; Infotext anzeigen:
SplashTextOn('Info: ', 'Bitte markieren Sie den Bereich, von dem Sie einen ScreenShot erstellt haben wollen. ', 400, 50, (@DesktopWidth / 2) - 200, (@DesktopHeight / 2) - 25)
Sleep(2000)
SplashOff()
While 1
If _IsPressed("01", $UserDLL) Then
Local $Start_Pos = MouseGetPos()
draw_label()
ExitLoop
EndIf
WEnd
While 1
If Not _IsPressed("01", $UserDLL) Then
Local $End_Pos = MouseGetPos()
SplashOff()
ToolTip("")
;rechts oben nach links unten:
If $End_Pos[0] > $Start_Pos[0] And $End_Pos[1] > $Start_Pos[1] Then
$left = $Start_Pos[0]
$top = $Start_Pos[1]
$width = $End_Pos[0] - $Start_Pos[0]
$height = $End_Pos[1] - $Start_Pos[1]
EndIf
;rechts unten nach links oben:
If $End_Pos[0] > $Start_Pos[0] And $End_Pos[1] < $Start_Pos[1] Then
$left = $Start_Pos[0]
$top = $End_Pos[1]
$width = $End_Pos[0] - $Start_Pos[0]
$height = $Start_Pos[1] - $End_Pos[1]
EndIf
;links oben nach rechts unten:
If $End_Pos[0] < $Start_Pos[0] And $End_Pos[1] > $Start_Pos[1] Then
$left = $End_Pos[0]
$top = $Start_Pos[1]
$width = $Start_Pos[0] - $End_Pos[0]
$height = $End_Pos[1] - $Start_Pos[1]
EndIf
;links unten nach rechts oben:
If $End_Pos[0] < $Start_Pos[0] And $End_Pos[1] < $Start_Pos[1] Then
$left = $End_Pos[0]
$top = $End_Pos[1]
$width = $Start_Pos[0] - $End_Pos[0]
$height = $Start_Pos[1] - $End_Pos[1]
EndIf
ExitLoop
EndIf
WEnd
DllClose($UserDLL)
GUISetCursor(2, 0); Mouse-Cursor umschalten, Pfeil
GUIDelete()
EndFunc ;==>_auswahl()
;*********************************************
; Auswahlbereich anzuzeigen *
;*********************************************
Func draw_label()
Local $User1DLL = DllOpen("user32.dll")
Local $MouseCoordMode, $Start_Pos1, $Ausschnitt, $Mouse_Pos
While 1
$MouseCoordMode = Opt('MouseCoordMode', 2)
$Start_Pos1 = MouseGetPos()
$Ausschnitt = GUICtrlCreateLabel('', 0, 0, 1, 1, $SS_SUNKEN)
GUICtrlSetBkColor($Ausschnitt, 0)
While _IsPressed("01", $User1DLL)
$Mouse_Pos = MouseGetPos()
Local $Pos_Lupe = MouseGetPos()
Local $Pos_Screen = ToolTip("X-Pos.: " & $Pos_Lupe[0] & @LF & "Y-Pos.: " & $Pos_Lupe[1] & @LF & "Breite: " & $Pos_Lupe[0] - $Start_Pos1[0] & @LF & "Höhe: " & $Pos_Lupe[1] - $Start_Pos1[1], $Pos_Lupe[0] + 20, $Pos_Lupe[1] + 120)
Local $Lupe = SplashTextOn("Lupe", "", 100, 100, $Pos_Lupe[0] + 20, $Pos_Lupe[1] + 20, 1)
Global $MyhWnd = WinGetHandle("Lupe")
Lupe()
;links oben nach rechts unten:
If $Mouse_Pos[1] > $Start_Pos1[1] And $Mouse_Pos[0] > $Start_Pos1[0] Then
GUICtrlSetPos($Ausschnitt, $Start_Pos1[0], $Start_Pos1[1], $Mouse_Pos[0] - $Start_Pos1[0], $Mouse_Pos[1] - $Start_Pos1[1])
Sleep(10)
EndIf
;links unten nach rechts oben:
If $Mouse_Pos[1] < $Start_Pos1[1] And $Mouse_Pos[0] > $Start_Pos1[0] Then
GUICtrlSetPos($Ausschnitt, $Start_Pos1[0], $Mouse_Pos[1], $Mouse_Pos[0] - $Start_Pos1[0], $Start_Pos1[1] - $Mouse_Pos[1])
Sleep(10)
EndIf
;rechts oben nach links unten:
If $Mouse_Pos[1] > $Start_Pos1[1] And $Mouse_Pos[0] < $Start_Pos1[0] Then
GUICtrlSetPos($Ausschnitt, $Mouse_Pos[0], $Start_Pos1[1], $Start_Pos1[0] - $Mouse_Pos[0], $Mouse_Pos[1] - $Start_Pos1[1])
Sleep(10)
EndIf
;rechts unten nach links oben:
If $Mouse_Pos[1] < $Start_Pos1[1] And $Mouse_Pos[0] < $Start_Pos1[0] Then
GUICtrlSetPos($Ausschnitt, $Mouse_Pos[0], $Mouse_Pos[1], $Start_Pos1[0] - $Mouse_Pos[0], $Start_Pos1[1] - $Mouse_Pos[1])
Sleep(10)
EndIf
WEnd
Opt('MouseCoordMode', $MouseCoordMode)
Return $Ausschnitt
Sleep(10)
WEnd
DllClose($User1DLL)
EndFunc ;==>draw_label()
;*********************************
; Bildschirmlupe *
;*********************************
Func Lupe()
Global $MyHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $MyhWnd)
If @error Then Return
Global $DeskHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", 0)
If Not @error Then
$xy = MouseGetPos()
If Not @error Then
$l = $xy[0] - 10
$t = $xy[1] - 10
DllCall("gdi32.dll", "int", "StretchBlt", "int", $MyHDC[0], "int", 0, "int", 0, "int", 100, "int", 100, "int", $DeskHDC[0], "int", $l, "int", $t, "int", 20, "int", 20, "long", $SRCCOPY)
EndIf
DllCall("user32.dll", "int", "ReleaseDC", "int", $DeskHDC[0], "hwnd", 0)
EndIf
DllCall("user32.dll", "int", "ReleaseDC", "int", $MyHDC[0], "hwnd", $MyhWnd)
EndFunc ;==>Lupe()