I developed a Windows Forms application to capture the windows of a video chat application (inbound, aka Remote and outbound, aka Local). For this I use unmanaged Windows API code. Here is the Capture code:
// Set Local Window localHandle = FindWindow(null, "local"); // Backup parent window for local prevLocalHandle = GetParent(localHandle); SetParent(localHandle, this.pBoxLocal.Handle); SetWindowLong(localHandle, GWL_STYLE, WS_VISIBLE + (WS_MAXIMIZE | WS_BORDER | WS_DISABLED)); MoveWindow(localHandle, 0, -TOP_BAR_HEIGHT, this.pBoxLocal.Width, this.pBoxLocal.Height + LOWER_BAR_HEIGHT, true); // Set Remote Window remoteHandle = FindWindow(null, "remote"); // Backup parent window for remote prevRemoteHandle = GetParent(remoteHandle); SetParent(remoteHandle, this.pBoxRemote.Handle); SetWindowLong(remoteHandle, GWL_STYLE, WS_VISIBLE + (WS_MAXIMIZE | WS_BORDER | WS_DISABLED)); MoveWindow(remoteHandle, 0, -TOP_BAR_HEIGHT, this.pBoxRemote.Width, this.pBoxRemote.Height + LOWER_BAR_HEIGHT, true);
Here is the return code:
// Return Windows SetParent(localHandle, prevLocalHandle); SetWindowLong(localHandle, GWL_STYLE, (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)); MoveWindow(localHandle, 0, 0, NORMAL_WIDTH, NORMAL_HEIGHT, true); SetParent(remoteHandle, prevRemoteHandle); SetWindowLong(remoteHandle, GWL_STYLE, (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)); MoveWindow(remoteHandle, 0, 0, NORMAL_WIDTH, NORMAL_HEIGHT, true);
The goal is to move from this: 
For this:

And again!:)
I currently have two questions:
First of all, when I return the windows to the video chat application, sometimes a black rectangle remains in the upper left corner of the screen. It disappears when I update the area.
second and, most importantly, there are times when I capture the application window, I also fix its toolbars (although the measurements that I supply are only those that relate to the video area in the window).
Is there a better way to do this? Even if these are simply the best features! Remember: I want to get the video chat application windows and return them later.
Thanks in advance for any advice!