捕获WPF窗口的屏幕截图的源示例 [英] Source example for capturing a screen capture of a WPF Window

查看:111
本文介绍了捕获WPF窗口的屏幕截图的源示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在使用White API来控制WPF应用程序,但是White API没有功能来为其生成UI事件的当前窗口生成位图图像.因此,我正在寻找一些示例代码,可以在其中捕获在单独的进程(正在测试的应用程序)中运行的外部WPF窗口的快照,并传入UIAutomationClient.AutomationElement.到目前为止,我仅设法找到了GDI屏幕捕获应用程序的屏幕捕获源示例,在这些示例中,它们无法捕获正在运行的WPF应用程序的图像.任何关于在哪里看的建议都将不胜感激.

Currently I am using the White API to control a WPF application, but the White API has no functionality to generate a bitmap image of the current window for which it is generating UI events for. So, I am looking for some example code where I can take a snapshot of an external WPF window running in a separate process (application under test) passing in an UIAutomationClient.AutomationElement. So far, I have only managed to find screen capture source examples for GDI screen capture applications where they will not capture the image of a running WPF application. Any suggestions on where to look is greatly appreciated.

推荐答案

我在google上发现了这个问题:
http://www.c-sharpcorner.com/UploadFile/perrylee/ScreenCapture11142005234547PM/ScreenCapture.aspx [ ^ ]

在使用该示例之前,我将检查pInvoke以获得互操作调用的正确签名,因为我几乎可以肯定,您在提供的链接上看到的内容在64位系统上不起作用. pInvoke具有正确的方法原型.
I found this on google:

http://www.c-sharpcorner.com/UploadFile/perrylee/ScreenCapture11142005234547PM/ScreenCapture.aspx[^]

Before using that example, I would check pInvoke for the correct signatures of the interop calls because I''m almost positive that what you see at the link provided won''t work on a 64-bit system. pInvoke has the right method prototypes.


这篇关于捕获WPF窗口的屏幕截图的源示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆