Forum Discussion
Sharing part of the screen
- Apr 28, 2021Seem to be not possible at the moment, but heavily requested by user voices: https://microsoftteams.uservoice.com/forums/555103-public/suggestions/38834104-share-custom-area-of-screen
Hi PyKen, thanks again for your effort, much appreciated! 🙂 I'll be testing your updated version over the next few hours.
This morning I tested Teams sharing with my work colleagues and it didn't work as expected, they couldn't see the contents of the Main Window. I set up a Teams call this evening from work to my home account and I found that moving the Main Window 'out of the way' (= outside of the visible desktop) doesn't work. In summary, I found the following on the receiver side of Teams sharing:
1. Nothing is shared if the Main Window is fully covered by another window.
2. The Main Window is fully shared if it is partially covered by another window.
3. If the Main Window is partially pushed outside of the desktop area, only the visible part of the Main Window is shared, zoomed.
4. If the Main Window is minimized, nothing is shown (normal Teams behavior).
5. If the Main Window is hidden, it turns black, as does the shared content (I used WinSpy to get the handle and AutoHotkey to hide the window).
If 3 were not the case, you could just push the Main Window to a place outside of the visible desktop. Is there a way to fully render the Main Window even when it's outside of the visible desktop? Because that would be a perfect! As it stands, when sharing half of my ultrawide screen the other half will be occupied by the Main Window, whereas you'd want to use that space to prepare whatever you're going to drag into the shared rectangle. If you manage to solve that issue, you can start asking $$$ for your solution! 🙂
ProMaceThanks for your extensive tests! I have released a small fix for 1.
1 and 2. Thanks, I fixed this in v1.1.1. The window should continue rendering now, even if it is completely covered by other windows.
3. Unfortunately, this is a Teams limitation. A capture in OBS has no problems with it. As a workaround, I made sure the Main Window always stays within the screen.
4. Yes, it seems that Teams stops recording when the window is minimized. I am not sure if it is possible to render while minimized.
5. What do you mean with 'hidden'? Is there another way to cover a window?
If 1 is not a solution for you, you can actually use virtual desktops. A bit complicated to start, but you can move the Main window to another virtual desktop after selecting it for screen sharing!
- ProMaceNov 29, 2021Copper Contributor
PyKen You, my friend, are an asset to humanity... Your fix works just fine for me! So no need for virtual desktops.
After some further testing, I found a few small remaining issues:
1. When using DPI settings > 100% (I use 125%), the effective screen pixel coordinates of the 2 windows will be off by DPI / 100. So for instance, if DPI = 125 then (2560, 0) effectively becomes (3200, 0). I can compensate for this through the coordinates passed to the app, in the example I can multiply by 100/125 which yields (2048, 0). It would be cool if you could implement a parameter --dpi and then perform the correction (100 * coordinate) / --dpi internally within the app!
2. It appears that the Main Window has a positive offset on the passed (x, y) coordinate. It looks like it's being positioned at (x + N, y + N). In my use case this causes a slight overlap with the capturing rectangle as I'm positioning the Main Window at (0, 0) and the Capture Window at (2560, 0). Moving the Main Window to the left and top, outside of the desktop area, causes it to snap (as per your fix) into the (0, 0) position which is where I expect it to be.
Regarding your question about hiding a window: AutoHotkey has a function WinHide that makes the window invisible. I assume Windows simply stops rendering the window, which is why it can't be used in our screen sharing scenario. I think AutoHotkey is calling a low-level Windows API to make a window invisible. See https://www.autohotkey.com/boards/viewtopic.php?style=17&t=63297
If you could look into these small issues, that would be great! I've already had my X-mas present for sure!
Best regards,
ProMace
- PyKenNov 30, 2021Copper Contributor
ProMace Glad to hear it works well on your end as well:D And thanks for pointing out further issues:)
1. I made v1.2.0 to ignore scaling by default as it causes recorded images to blur (i.e. you do not need to calculate beforehand). The old behavior can be enabled with --consider-scale
2. Hmm I cannot confirm this, in my case, the rendering window spawns at exactly (0,0). Could it be the case that you are running some other applications related to window placement?
Interesting feature by AutoHotkey there... might look into it if the current workaround does not work one day^^
- ProMaceDec 01, 2021Copper Contributor
Hi PyKen, I did a few tests sharing from home --> work and these are the results:
Not running as administrator
- Positioning of the Main Window works fine. This helps confirm that Windows policies are interfering one way or another on my company laptop.
- Sharing works fine.
Running as administrator
- Positioning of the Main Window works fine.
- Sharing exhibits the same gray 'ghost window' effect. So this issue appears to be of a more general nature. Can you reproduce this?
Very curious to find out why 'run as admin' is causing an issue!
Best regards,
ProMace