[GH-ISSUE #120] Snap to Window, doesnt capture whole windows or dialogs #108

Closed
opened 2026-02-26 08:45:21 +03:00 by kerem · 17 comments
Owner

Originally created by @ltc-data on GitHub (Apr 17, 2017).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/120

Originally assigned to: @NickeManarin on GitHub.

This has been a problem for many versions, Snap is essentially broken you cant select a whole Window or dialog only the inner portions of either, so if capture involves these parts they are left out.

Only way to get the whole area is by manually expanding ScreenToGif capture area.

ScreenToGif version: 2.7.1
OS: Windows 7 Ultimate Sp1 / Windows 10 1607 / 1703

Captures of problem.

Snap to whole dialog - Mission impossible 1
solve

Snap to whole Window - Mission Impossible 2
solve2

Good capture examples - Expected area snap should snap to.

These were captured with Snipping tool to illustrate the expected areas of dialogs / windows to be captured by snap.

Dialog
solve

Window
solve2

Originally created by @ltc-data on GitHub (Apr 17, 2017). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/120 Originally assigned to: @NickeManarin on GitHub. This has been a problem for many versions, Snap is essentially broken you cant select a whole Window or dialog only the inner portions of either, so if capture involves these parts they are left out. Only way to get the whole area is by manually expanding ScreenToGif capture area. ScreenToGif version: 2.7.1 OS: Windows 7 Ultimate Sp1 / Windows 10 1607 / 1703 ## Captures of problem. **Snap to whole dialog - Mission impossible 1** ![solve](https://cloud.githubusercontent.com/assets/25669462/25085149/90f56d98-2358-11e7-9d22-b84a98374422.gif) **Snap to whole Window - Mission Impossible 2** ![solve2](https://cloud.githubusercontent.com/assets/25669462/25085232/fedce23c-2358-11e7-81cd-fcb7ce9baaec.gif) ## Good capture examples - Expected area snap should snap to. These were captured with Snipping tool to illustrate the expected areas of dialogs / windows to be captured by snap. **Dialog** ![solve](https://cloud.githubusercontent.com/assets/25669462/25085322/74168094-2359-11e7-9150-dc707dfbd8e9.PNG) **Window** ![solve2](https://cloud.githubusercontent.com/assets/25669462/25085332/805bdcfa-2359-11e7-9454-2c4c1c02007a.PNG)
kerem 2026-02-26 08:45:21 +03:00
Author
Owner

@NickeManarin commented on GitHub (Apr 17, 2017):

Oh, it's a problem with the rectangle that for some reason fails to be painted on top of the window chrome/border.

I tested with W10 1607, the app snaps to the entire window, just the rectangle that does not show.

But I realized that I can improve the snapping region, expand a little bit to fit the whole window + border.

lol

<!-- gh-comment-id:294464739 --> @NickeManarin commented on GitHub (Apr 17, 2017): Oh, it's a problem with the rectangle that for some reason fails to be painted on top of the window chrome/border. I tested with W10 1607, the app snaps to the entire window, just the rectangle that does not show. But I realized that I can improve the snapping region, expand a little bit to fit the whole window + border. ![lol](https://cloud.githubusercontent.com/assets/14798947/25087879/76150dfe-2348-11e7-882d-62e2a6696810.gif)
Author
Owner

@ltc-data commented on GitHub (Apr 17, 2017):

Ah right you are, so that is the actual issue, because I didnt see a painted area around the desired Windows/Dialog complete area, naturally assumed that it wasnt being selected.

As an offtopic: see https://www.windows10forums.com/threads/screentogif-if-a-picture-speaks-1000-words-a-sequence-speaks-volumes.12790/

<!-- gh-comment-id:294492019 --> @ltc-data commented on GitHub (Apr 17, 2017): Ah right you are, so that is the actual issue, because I didnt see a painted area around the desired Windows/Dialog complete area, naturally assumed that it wasnt being selected. As an offtopic: see https://www.windows10forums.com/threads/screentogif-if-a-picture-speaks-1000-words-a-sequence-speaks-volumes.12790/
Author
Owner

@ltc-data commented on GitHub (Apr 17, 2017):

Actually there seems to be a bigger issue at least here.

I was just trying to capture my NIC properties dialog via snap and it will definetly not snap.

ugh

the only way was manually

pattermatch

<!-- gh-comment-id:294501337 --> @ltc-data commented on GitHub (Apr 17, 2017): Actually there seems to be a bigger issue at least here. I was just trying to capture my NIC properties dialog via snap and it will definetly not snap. ![ugh](https://cloud.githubusercontent.com/assets/25669462/25092424/89249d78-2385-11e7-94b7-e03f160bb352.gif) the only way was manually ![pattermatch](https://cloud.githubusercontent.com/assets/25669462/25092430/923c1008-2385-11e7-85b5-a035686ae786.gif)
Author
Owner

@NickeManarin commented on GitHub (Apr 17, 2017):

Indeed, just tested.
Is it a window opened with admin rights? It looks like it's not working with any window like that.

<!-- gh-comment-id:294503096 --> @NickeManarin commented on GitHub (Apr 17, 2017): Indeed, just tested. Is it a window opened with admin rights? It looks like it's not working with any window like that.
Author
Owner

@ltc-data commented on GitHub (Apr 17, 2017):

No admin rights on that one, there wasnt even UAC prompt.

<!-- gh-comment-id:294517819 --> @ltc-data commented on GitHub (Apr 17, 2017): No admin rights on that one, there wasnt even UAC prompt.
Author
Owner

@NickeManarin commented on GitHub (Apr 21, 2017):

Alright, it looks like I'm not able to get any MouseUp/MouseDown events while the cursor is on top of windows opened with admin rights (the adapter properties window follows the same rule, it just doesn't show any UAC dialog, you can see by the shield icon of the context menu)

image

So, in order to work, I had to make a little hack. For that kind of window, the Snap To Window will only work after you release the mouse button AND move the cursor after that.

Also I adjusted the region of snap, it will show the border of the window.

This fix will be available for v2.7.2 or v2.8.0.

Thanks for the feedback.

<!-- gh-comment-id:296053325 --> @NickeManarin commented on GitHub (Apr 21, 2017): Alright, it looks like I'm not able to get any MouseUp/MouseDown events while the cursor is on top of windows opened with admin rights (the adapter properties window follows the same rule, it just doesn't show any UAC dialog, you can see by the shield icon of the context menu) ![image](https://cloud.githubusercontent.com/assets/14798947/25262599/6a94bdf0-262f-11e7-9821-79b5ce75c4bf.png) So, in order to work, I had to make a little hack. For that kind of window, the Snap To Window will only work after you release the mouse button AND move the cursor after that. Also I adjusted the region of snap, it will show the border of the window. This fix will be available for v2.7.2 or v2.8.0. Thanks for the feedback.
Author
Owner

@ltc-data commented on GitHub (Apr 21, 2017):

No problem, and thank you for the fix. will be looking forward to see it.

<!-- gh-comment-id:296114159 --> @ltc-data commented on GitHub (Apr 21, 2017): No problem, and thank you for the fix. will be looking forward to see it.
Author
Owner

@Partixel commented on GitHub (May 12, 2017):

@NickeManarin
The visual bug is still happening ( Doesn't have admin privileges ):
gif 1

<!-- gh-comment-id:301076766 --> @Partixel commented on GitHub (May 12, 2017): @NickeManarin The visual bug is still happening ( Doesn't have admin privileges ): ![gif 1](https://cloud.githubusercontent.com/assets/2728862/26000061/5a94dba0-371f-11e7-98c8-37d2e1a73ea9.gif)
Author
Owner

@NickeManarin commented on GitHub (May 12, 2017):

Looks alright. The small offset will not be recorded.

<!-- gh-comment-id:301078573 --> @NickeManarin commented on GitHub (May 12, 2017): Looks alright. The small offset will not be recorded.
Author
Owner

@Partixel commented on GitHub (May 12, 2017):

Sorry, I meant it doesn't show around the edge of the window when I hover over the top bar

<!-- gh-comment-id:301079027 --> @Partixel commented on GitHub (May 12, 2017): Sorry, I meant it doesn't show around the edge of the window when I hover over the top bar
Author
Owner

@NickeManarin commented on GitHub (May 12, 2017):

Oh, that I could not fix... I'm not sure why. I'm using the a Windows API to draw the rectangle.

<!-- gh-comment-id:301079507 --> @NickeManarin commented on GitHub (May 12, 2017): Oh, that I could not fix... I'm not sure why. I'm using the a Windows API to draw the rectangle.
Author
Owner

@Partixel commented on GitHub (May 12, 2017):

Very weird :(

<!-- gh-comment-id:301080059 --> @Partixel commented on GitHub (May 12, 2017): Very weird :(
Author
Owner

@Partixel commented on GitHub (May 12, 2017):

I think I figured out what's going on.

You're creating it in the context of the window the mouse is over, which has a clipping zone around itself, not including the title bar.

Maybe create the rectangles in the context of the screen2gif window so it isn't clipped?

( I've never used VS before, this was just from a quick look around and google )

<!-- gh-comment-id:301091676 --> @Partixel commented on GitHub (May 12, 2017): I think I figured out what's going on. You're creating it in the context of the window the mouse is over, which has a clipping zone around itself, not including the title bar. Maybe create the rectangles in the context of the screen2gif window so it isn't clipped? ( I've never used VS before, this was just from a quick look around and google )
Author
Owner

@Partixel commented on GitHub (May 12, 2017):

Working code snippet:
Change line 769 of Native to var hdc = GetWindowDC((IntPtr) null);
Remove line 775 of Native

Seems to cause a lot of lag when moving the mouse around though, No idea if that's because I'm running it from VS?

<!-- gh-comment-id:301095504 --> @Partixel commented on GitHub (May 12, 2017): Working code snippet: Change line 769 of Native to `var hdc = GetWindowDC((IntPtr) null);` Remove line 775 of Native Seems to cause a lot of lag when moving the mouse around though, No idea if that's because I'm running it from VS?
Author
Owner

@Partixel commented on GitHub (May 12, 2017):

Also thanks to that fix I noticed you can select Screen2Gifs window.. Not sure if that's a bug?

<!-- gh-comment-id:301096406 --> @Partixel commented on GitHub (May 12, 2017): Also thanks to that fix I noticed you can select Screen2Gifs window.. Not sure if that's a bug?
Author
Owner

@NickeManarin commented on GitHub (May 14, 2017):

Awesome, thanks. Which line exactly to remove? Looks like we have different source codes...

Yeah, it lags because of the MouseHook, the listener that capture mouse inputs outside the app. When running from the VS, it will lag a lot.

Indeed a bug.

<!-- gh-comment-id:301285128 --> @NickeManarin commented on GitHub (May 14, 2017): Awesome, thanks. Which line exactly to remove? Looks like we have different source codes... Yeah, it lags because of the MouseHook, the listener that capture mouse inputs outside the app. When running from the VS, it will lag a lot. Indeed a bug.
Author
Owner

@Partixel commented on GitHub (May 14, 2017):

The OffsetRect(ref rect, -rect.Left, -rect.Top); line as it's now being drawn from the edge of the screen

<!-- gh-comment-id:301304178 --> @Partixel commented on GitHub (May 14, 2017): The ``OffsetRect(ref rect, -rect.Left, -rect.Top);`` line as it's now being drawn from the edge of the screen
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#108
No description provided.