捕获DirectX应用程序的视觉输出-即使在后台? [英] Capture visual output of a DirectX application - even in background?

查看:64
本文介绍了捕获DirectX应用程序的视觉输出-即使在后台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要捕获DirectX窗口的视觉输出(如屏幕截图)。
当前,我使用此方法

但是,当窗口在背景中时,它会捕获它前面的任何东西。

I need to capture the visual output (like a screenshot) of a DirectX window. Currently, I use this approach.
But, when the window is in background, it captures whatever is in front of it.

我看到DirectX窗口即使在最小化或在背景中时也会渲染,所以这应该是可能的。

但是,如何? (不幸的是,它也需要快速运行,并且也需要在Windows XP上运行。)

I see that DirectX windows render even when minimized or in background, so this should be possible.
But, how? (It also needs to be fast, and it needs to work on Windows XP too, unfortunately...)

编辑:我非常这些天很忙...别担心,如果赏金过期了,我会把它退还。

Edit: I am very busy these days... Don't worry, I'll put the bounty back if it expires.

推荐答案

捕获Direct3D处于后台(或移出屏幕)的窗口,我相信您有以下选择:

To capture Direct3D windows that are in the background (or moved off screen), I believe you have the following options:


  1. 注入并钩住Direct3D在目标应用程序中通过链接发布的内容已经或更近的示例(EasyHook可能很难设置,但确实工作得很好)-您可以随时寻求帮助关于使其工作。我已经使用该技术捕获了许多没有问题的游戏(最近是用于歧义克隆项目)。这种方法的问题是您对引起禁令的游戏保护感到担忧,但是FRAP也使用钩子来实现这一目标,所以也许您的担忧被夸大了?我猜游戏玩家被禁止屏幕快照是一种昂贵的发现方法。

  1. Inject and hook Direct3D within the target application via the link you have already posted or this more up-to-date example (EasyHook can be difficult to get setup but it does work really well) - you can always ask for help about getting it working. I have used that technique for capturing in a number of games without issues (most recently for an ambilight-clone project). The problem with this approach is your concern about game protection causing bans, however FRAPs also uses hooking to achieve this, so perhaps your concerns are exaggerated? I guess gamers being banned for a screen shot is an expensive way of finding out.

对于Vista / Win 7上的窗口化应用程序,您可以注入并挂钩DWM,并通过其共享界面发出捕获请求。我已经在Vista上运行,但是尚未完成在Windows 7上的运行,下面是在Windows 7上运行的示例。 http:// www.youtube.com/watch?v=G75WKeXqXkc 。这种方法的主要问题是使用了未记录的API,这可能意味着您的应用程序在Windows补丁发布时就没有任何警告就被破坏了-您还必须针对每种新的主要Windows版本重新使用该技术。这也不能满足您在Windows XP中捕获的需求。

For windowed applications on Vista/Win 7 - you could inject and hook the DWM and make your capture requests through its shared surface. I have had this working on Vista, but have not finished getting it working on Windows 7, here is an example of it working for Windows 7 http://www.youtube.com/watch?v=G75WKeXqXkc. The main problem with this approach is the use of undocumented API's which could mean your application breaks without any warning upon a windows patch release - also you would have to redo the technique for each new major Windows flavour. This also does not address your need to capture in Windows XP.

在DWM中也有一个缩略图API。这取决于您的尝试进行操作。有关此API以及其他DWM API的一些信息,请参见 http://blogs.msdn.com/b/greg_schechter/archive/2006/09/14/753605.aspx

Also within the DWM, there is a thumbnail API. This has limitations depending on what your trying to do. There is some information on this API along with other DWM API's here http://blogs.msdn.com/b/greg_schechter/archive/2006/09/14/753605.aspx

还有其他在不使用EasyHook的情况下拦截Direct3D调用的技术,例如用包装器替换各种DLL。您还可以在这里找到其他各种吸引/拦截游戏的技术: http://www.gamedeception.net/

There are other techniques for intercepting the Direct3D calls without using EasyHook, such as substituting the various DLL's with wrappers. You will find various other game hooking/interception techniques here: http://www.gamedeception.net/

简单地将Direct3D应用程序置于前台(我想这在您的情况下是不可取的)-除非您还移动了屏幕外窗口,否则这不适用于屏幕外窗口

Simply bring the Direct3D application to the foreground (which I guess is undesirable in your situation) - this wouldn't work for off-screen windows unless you also move the window.

不幸的是,我能想到的唯一Windows XP解决方案是拦截某种形式的Direct3D API。

Unfortunately the only solution for Windows XP that I can think of is intercepting the Direct3D API in some form.

仅在最小化Direct3D渲染时进行说明。在我对此事的有限测试中,我发现这取决于应用程序。通常不推荐,该渲染是在应用程序最小化时进行的(还有这个参考),它在后台时仍会继续渲染

Just a clarification on Direct3D rendering while minimised. During my fairly limited testing on this matter I have found this to be application dependant; it is generally not recommended that rendering take place while the application is minimized (also this reference), it does continue to render while in the background however.

更新:提供了指向第1点的最新注入示例的附加链接。

UPDATED: provided additional link to more up-to-date injection example for point 1.

这篇关于捕获DirectX应用程序的视觉输出-即使在后台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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