Skip to content

Commit f647fbe

Browse files
committed
Revert "More correct window image (screenshot) without frame bounds"
This reverts commit acd9e90.
1 parent 176e76b commit f647fbe

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

WindowTextExtractor/Utils/WindowUtils.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public static WindowInformation GetWindowInformation(IntPtr handle, Point cursor
302302

303303
public static Bitmap CaptureWindow(IntPtr handle, bool captureCursor = false)
304304
{
305-
var rectangle = GetWindowRectWithoutMargins(handle);
305+
User32.GetWindowRect(handle, out var rectangle);
306306
var posX = rectangle.Left;
307307
var posY = rectangle.Top;
308308
var width = rectangle.Width;
@@ -534,21 +534,6 @@ private static Color GetColorUnderCursor(Point cursorPosition)
534534
return color;
535535
}
536536

537-
private static Rect GetWindowRectWithoutMargins(IntPtr hWnd)
538-
{
539-
Rect size;
540-
if (Environment.OSVersion.Version.Major < 6)
541-
{
542-
User32.GetWindowRect(hWnd, out size);
543-
}
544-
else if (Dwmapi.DwmGetWindowAttribute(hWnd, Constants.DWMWA_EXTENDED_FRAME_BOUNDS, out size, Marshal.SizeOf(typeof(Rect))) != 0)
545-
{
546-
User32.GetWindowRect(hWnd, out size);
547-
}
548-
return size;
549-
}
550-
551-
552537
private class WmiProcessInfo
553538
{
554539
public string CommandLine { get; set; }

0 commit comments

Comments
 (0)