Modify

Opened 15 years ago

Closed 14 years ago

#1977 closed Bug (No Bug)

_ScreenCapture_CaptureWnd - wrong capture on maximized window

Reported by: MrCreatoR <mscreator@…> Owned by:
Milestone: Component: Standard UDFs
Version: 3.3.6.1 Severity: None
Keywords: Cc:

Description

Whe we use _ScreenCapture_CaptureWnd on maximized window, there is extra pixels that should not be captured (it's the size of the window borders).

The fix is simple, just calculate the size of the border of specified window in case it's maximized:

Func _ScreenCapture_CaptureWnd($sFileName, $hWnd, $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1, $fCursor = True)
	Local $tRect = _WinAPI_GetWindowRect($hWnd)
	Local $aWinClientSize, $aWinPos, $iBorder
	
	If BitAND(WinGetState($hWnd), 32) Then ;windows is maximized
		$aWinClientSize = WinGetClientSize($hWnd)
		$aWinPos = WinGetPos($hWnd)
		If Not @error Then $iBorder = ($aWinPos[2] - $aWinClientSize[0]) / 2
	EndIf
	
	$iLeft += DllStructGetData($tRect, "Left") + $iBorder
	$iTop += DllStructGetData($tRect, "Top") + $iBorder
	If $iRight = -1 Then $iRight = DllStructGetData($tRect, "Right") - DllStructGetData($tRect, "Left") - $iBorder
	If $iBottom = -1 Then $iBottom = DllStructGetData($tRect, "Bottom") - DllStructGetData($tRect, "Top") - $iBorder
	....
EndFunc

Attachments (0)

Change History (3)

comment:1 by MrCreatoR <mscreator@…>, 15 years ago

One small correction, the $iBorder initialy should be = 1 (Local ..., $iBoderd = 1), because when capturing not maximized window, it's also captured with extra pixels, it's probably the same issue as it was with _ScreenCapture_Capture.

comment:2 by trancexx, 14 years ago

Component: AutoItStandard UDFs

comment:3 by guinness, 14 years ago

Resolution: No Bug
Status: newclosed

Fixed in Rev [5806] for Trac Ticket #1614.

Please use the latest stable release.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.