Modify ↓
Opened 15 years ago
Closed 14 years ago
#1977 closed Bug (No Bug)
_ScreenCapture_CaptureWnd - wrong capture on maximized window
| Reported by: | 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 , 15 years ago
comment:2 by , 14 years ago
| Component: | AutoIt → Standard UDFs |
|---|
comment:3 by , 14 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

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.