C#屏幕捕获并行?

时间:2011-04-07 21:01:55

标签: c# screenshot

我想捕获应用程序窗口的屏幕截图。我可以使用下面这样做。但是,是否可以在parrall中执行此操作,还是必须按顺序执行此操作?

我目前正在使用this

ScreenCapture sc = new ScreenCapture(); // capture entire screen, and save it to a file 
Image img = sc.CaptureScreen(); // display image in a Picture control named imageDisplay 
this.imageDisplay.Image = img;  // capture this window, and save it 
sc.CaptureWindowToFile(this.Handle,"C:\\temp2.gif",ImageFormat.Gif);

对于两个或更多应用程序窗口,我是否可以并行拍摄屏幕截图?

2 个答案:

答案 0 :(得分:2)

我之前从未使用过该库,但是从您的代码示例中看来,您似乎没有捕获特定窗口,而是整个屏幕。

似乎你想要使用这个功能

public void CaptureWindowToFile(IntPtr handle, string filename, ImageFormat format)

并将其传递给要捕获的应用程序窗口的句柄。看起来你可以在库中使用它,只需要获取正确窗口的句柄。

答案 1 :(得分:0)

您可能想要查看“线程”:

基本上,您应该启动并发线程来处理特定的工作,例如将窗口句柄作为线程作业的参数。