Opened 13 years ago

Closed 11 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: Severity: None
Keywords: Cc:


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
	$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

Attachments (0)

Change History (3)

comment:1 Changed 13 years ago by MrCreatoR <mscreator@…>

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 Changed 12 years ago by trancexx

  • Component changed from AutoIt to Standard UDFs

comment:3 Changed 11 years ago by guinness

  • Resolution set to No Bug
  • Status changed from new to closed

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

Please use the latest stable release.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.