问题描述
一段时间以来我一直在愚弄屏幕捕获,我设法捕获了整个屏幕,屏幕上的某些区域等等...
I have been fooling around with screen capture for awhile now and I managed to capture the entire screen, certain areas on the screen etc...
但是当我进入游戏并尝试捕获屏幕,它完全忽略了游戏,而是捕获了桌面(或游戏窗口后面的任何内容)。
另一个有趣的事实是PrtScn按钮也会发生同样的事情。
But when I go into a game and try to capture the screen, it completely ignores the game and instead, captures the desktop (or whatever is behind the game window).Another interesting fact is that the same thing happens with the PrtScn button.
关于如何捕获游戏屏幕的任何想法?
Any ideas on how to capture a game's screen?
推荐答案
您正在使用的屏幕捕获技术可以很好地捕获非硬件加速的内容。我怀疑您尝试在Windows Media Player中捕获电影帧时也会遇到相同的问题。
The screen capturing technique you are using works well for capturing things that aren't hardware accelerated. I suspect you'd have the same problem trying to capture a movie frame in Windows Media Player.
解决方案是使用DirectX从硬件本身进行屏幕捕获。 说明了如何使用一些代码和托管包装器在DirectX周围称为。
The solution is the do a screen capture from the hardware itself using DirectX. This article explains how to do that with some code and a managed wrapper around DirectX called SlimDX.
编辑
如果Slim DX对您不起作用,那么您只需要在Direct X周围找到另一个托管包装即可。我认为您不进行以下操作就无法进行屏幕捕获:硬件级别,而DirectX是在Windows平台上做到这一点的方法。
EDITIf Slim DX doesn't work for you, then you'd just have to find another managed wrapper around Direct X. I don't think you are going to be able to do the screen capture without working at the hardware level, and DirectX is the means of doing that on the Windows platform.
这篇关于C#捕获直接3D屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!