I'm working in a company where the owner wish take a screenshot of a windows mail app; specifically the section where the e-mail are show; and if the window or the section have an scroll, then must avoid it and take the screenshot of that whole section.
I'm building it on a .net console app, and I have download a lot of examples where shows just how to take a screeshot of an specific or any window.
The closest code (I think) that I found was this:
IntPtr current = IntPtr.Zero;
IntPtr handle = IntPtr.Zero;
List<IntPtr> thumbs = new List<IntPtr>();
if (handle == IntPtr.Zero)
handle = ((System.Windows.Interop.HwndSource)System.Windows.Interop.HwndSource.FromVisual(this)).Handle;
current = DWM.GetWindow(handle, DWM.GetWindowCmd.First);
do
{
int GWL_STYLE = -16;
int TASKSTYLE = 0x10000000 | 0x00800000;
if (TASKSTYLE == (TASKSTYLE & DWM.GetWindowLong(current, GWL_STYLE)))
{
thumbs.Add(current);
}
current = DWM.GetWindow(current, DWM.GetWindowCmd.Next);
if (current == handle)
current = DWM.GetWindow(current, DWM.GetWindowCmd.Next);
}
while (current != IntPtr.Zero);
this.DataContext = thumbs;
What customer expects it's to take an screenshot of a windows mail app but as I said before, the section that shows the e-mail in fact. So, it must looks something like: