开发者

Is it possible to screenshot a minimized application

开发者 https://www.devze.com 2023-01-07 13:50 出处:网络
I know it\'s po开发者_高级运维ssible to capture a screen of an application that is behind another application, but I can\'t seem to find anything on capturing the screen of a minimized application.

I know it's po开发者_高级运维ssible to capture a screen of an application that is behind another application, but I can't seem to find anything on capturing the screen of a minimized application.

Anyone happen to know if this is possible? I don't want to get into things like maximizing and minimizing the application really quick.


As @ziplin said with newer version of windows it may be possible (via DWM apis). From c# you can use the Windows API codepack to access the new apis


I don't believe so, simply because i've noticed programs that try to preview a window that is minimized seem to draw a blank on occasion if the window is minimized. Although, some new versions of windows (vista and 7, I believe) do this very thing, but I'm not sure how easy it is to replicate (at all)

: http://www.stardock.com/products/objectdock/


You can't without restoring the window. When a window is minimized, the application is not in a state to render a UI for your application to capture.


If anyone still wants to no a workable solution I tried this one and worked well for me. It does a trick for minimized windows (because windows does not refresh them, on the taskbar the iconic picture shows the last image of the window before it was minimized). And Ziplin above mentioned that Objectdock can capture minimized windows, actually it does the same as Windows, it uses the last image captured before minimizing.

So here is the link: http://www.codeproject.com/Articles/20651/Capturing-Minimized-Window-A-Kid-s-Trick


I've never tried it. This code claims looks reasonable, but has caveats about minimized windows. It is, if nothing else, a place to start.


As a last resort: why not capture window just before it gets minimized?


I know its too late, maybe it might help others.

I thought of a different approach, instead of minimizing, I moved my form outside my screen co-ordinates before capturing the screen and later respawned it. Below is my code example:

//Move the form beyond the screen
this.StartPosition = FormStartPosition.Manual;
      this.Location = new Point(Screen.PrimaryScreen.Bounds.Width + 10, Screen.PrimaryScreen.Bounds.Height + 10);

// Screenshot code here...

//Respawn the form to origin location
this.Location = currentPosition;
0

精彩评论

暂无评论...
验证码 换一张
取 消