Hallo,
Ich mache mit dieser funktion einen Screen.
[autoit]_ScreenCapture_CaptureWnd(@ScriptDir & "\screen.jpg", $hWnd)
[/autoit]
Dabei kommt ein Bild mit nem kleinen schwarzen rahmen und unten teilweise die Windows Leiste.
Wie schneid ich den ab?
Hallo,
Ich mache mit dieser funktion einen Screen.
[autoit]_ScreenCapture_CaptureWnd(@ScriptDir & "\screen.jpg", $hWnd)
[/autoit]
Dabei kommt ein Bild mit nem kleinen schwarzen rahmen und unten teilweise die Windows Leiste.
Wie schneid ich den ab?
Probiere es mal mit dieser Funktion:
[autoit]
Func __ScreenCapture_CaptureWnd($sFileName, $hWnd, $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1, $maximized = False)
Local $dex = 4, $dey = 1
Local $tRect = _WinAPI_GetWindowRect($hWnd)
If BitAND($maximized, 32) Then
$dex = 8
$dey = 8
EndIf
$iLeft += DllStructGetData($tRect, "Left")
$iTop += DllStructGetData($tRect, "Top")
If $iRight = -1 Then $iRight = DllStructGetData($tRect, "Right") - DllStructGetData($tRect, "Left")
If $iBottom = -1 Then $iBottom = DllStructGetData($tRect, "Bottom") - DllStructGetData($tRect, "Top")
$iRight += DllStructGetData($tRect, "Left")
$iBottom += DllStructGetData($tRect, "Top")
If $iLeft > DllStructGetData($tRect, "Right") Then $iLeft = DllStructGetData($tRect, "Left")
If $iTop > DllStructGetData($tRect, "Bottom") Then $iTop = DllStructGetData($tRect, "Top")
If $iRight > DllStructGetData($tRect, "Right") Then $iRight = DllStructGetData($tRect, "Right")
If $iBottom > DllStructGetData($tRect, "Bottom") Then $iBottom = DllStructGetData($tRect, "Bottom")
Return _ScreenCapture_Capture($sFileName, $iLeft + $dex, $iTop + $dey, $iRight - $dex, $iBottom- $dey, False)
EndFunc ;==>_ScreenCapture_CaptureWnd
Ist aus AutoIt Windows Screenshooter .
Gruß,
UEZ
hab die Funktion mal ein wenig umgeschrieben:
[autoit]#include <ScreenCapture.au3>
$sPath = @DesktopDir & "\screen.jpg"
$hWnd = WinGetHandle("Dein Fenster :D")
_ScreenCapture_CaptureOwnWnd($sPath, $hWnd)
Func _ScreenCapture_CaptureOwnWnd($sPath, $hWnd)
$Titel = WinGetTitle($hWnd)
$Pos = WinGetPos($Titel)
_ScreenCapture_Capture($sPath, $Pos[0] + 8, $Pos[1] + 8, ($Pos[2] - $Pos[0]) - 24, ($Pos[3] - $Pos[1]))
EndFunc ;==>_ScreenCapture_CaptureOwnWnd
danke euch,
habs jetzt so gemacht:
Func _ScreenCapture_CaptureOwnWnd($sPath, $hWnd)
$Titel = WinGetTitle($hWnd)
$Pos = WinGetPos($Titel)
_ScreenCapture_Capture($sPath, $Pos[0] + 8, $Pos[1] + 8, ($Pos[2] - $Pos[0]) - 24, ($Pos[3] + $Pos[1]) -8)
EndFunc ;==>_ScreenCapture_CaptureOwnWnd