'Get window handle from IRDPSRAPIWindow

I'm writing a desktop sharing application in C++ using IRDPSRAPI.

I would like to allow the user to select which window to share (as opposed to sharing the whole workspace).

I'm able to list the sharable windows, and enable/disable window sharing. However, when I enable application filtering and enable sharing of a single window (not a maximized one), an area corresponding to the whole screen in black, with that window inside of it, is shared (the size of the sharing doesn't change):

image

The non-selected windows are not visible on the viewer client. I would like to share an area corresponding only to the shared window instead:

image

When selecting the window to share, I can get its IRDPSRAIPWindow interface, so if somehow I could get its position and dimensions, I could use the IRDPSRAPISharingSession::SetDesktopSharedRect() method to crop the shared session to that window (until it's resized or moved), but I couldn't find how to get that position and dimensions given its IRDPSRAIPWindow. How can I get them?

Or, is there any other way to share only the area corresponding to the selected window?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source