Taking screenshot of a partially hidden window in

2019-01-26 20:33发布

Is it possible to get a screenshot of a window that is not on the top, i.e. if it is partially hidden by another window, without bringing it to the top?

2条回答
Juvenile、少年°
2楼-- · 2019-01-26 21:05

Unfortunately, it's not trivial to take a screen-shot in C# at all, you can create a graphics object based on the current window or viewport and capture that, but its not what you're asking for.

This

Screenshot of Hidden Window

might help, but you'd have to do this with Interop code anyway.

I dare say that it's not a common thing that is supported as really, one program has no business knowing what's being displayed in another program; it's potentially a nasty exploit.

查看更多
霸刀☆藐视天下
3楼-- · 2019-01-26 21:09

You dont need to take screenshot, if it is your application you can use Control.DrawToBitmap(Bitmap bitmap, Rectangle targetBounds); of the form object.

If it is other application window, you can try un-managed way to get the UI of window. I dont remember all the methods but I have tried and it was working. Probably GetWindow and SendMesage with WM_PRINT / WM_PRINTCLIENT

查看更多
登录 后发表回答