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
PyKen Brilliant mate... I was looking for something exactly like this!!
I have a humble request to make this even easier to use. Could you look into:
- Creating the selection rectangle at a desired location, width and height?
(command line parameters: sel_x, sel_y, sel_w, sel_h)
- A command line parameter to control whether the selection rectangle is visible or not? If I dedicate the right half of my ultrawide to sharing via Teams and the program starts up with fixed parameters (sel_x, sel_y, sel_w, sel_h), the selection border need not be visible.
- Moving the Main Window to a desired location (i.e. out of the way)?
(command line parameters: main_x, main_y)
I assume the Main Window must be visible (not hidden) for sharing purposes, otherwise a 'hide main window' parameter could also make sense. Minimizing it doesn't work, because Microsoft Teams will stop sharing any minimized window. So being able to move the Main Window to a location where it's less distracting would be fantastic. Many thanks in advance!
ProMace Thanks for the suggestions!:) I have added these features. After running the setup, you can run it (in case of the desktop link) like this
.\screen-area-share.lnk --cx=0 --cy=0 --cw=1920 --ch=1080 --rx=1920 --ry=0 --rw=1920 --rh=1080 --freeze
AFAIK hiding the main window is not possible. I have tried minimizing it as well. Moving the main window to another workspace does not help either. Currently, the only solution is to simply put another window above it.
- ProMaceNov 26, 2021Copper Contributor
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! 🙂- PyKenNov 29, 2021Copper Contributor
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