1

i would like to take a screenshot for a form of an opened application which is not on top without bringing this app on top to capture screenshot of the form ! i want to do it on C# i have searched a lot and i found nothing. would you please give any code hints?

Ahmed Sherif
  • 103
  • 10

1 Answers1

0

The PrintWindow API (MSDN) method can do that. You can use the API from C# using P/Invoke. The website pinvoke.net has the definition you need.

[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool PrintWindow(IntPtr hwnd, IntPtr hDC, uint nFlags);

You'll need a window handle which you can get like in this SO answer.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222