C# 使用设备和Surface 截图游戏

发布于 2024-12-02 11:23:43 字数 1022 浏览 1 评论 0原文

我最近发现了有关表面和表面的信息。 device 类可以解决我对全屏 direct3d 游戏进行屏幕截图的问题。

我尝试按照这篇文章进行操作: 在 C# 中捕获游戏屏幕截图的最快方法?(每秒超过 20 个图像)

我尝试过的第一种方法是:

Device device = new Device(0, DeviceType.Default, GetForegroundWindow(), CreateFlags.None, new PresentParameters());
Surface s2 = device.CreateImageSurface(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, Format.A8R8G8B8);
device.GetFrontBuffer(s2);
SurfaceLoader.Save("c:\\Screenshot.bmp", ImageFileFormat.Bmp, s2);

我尝试过的第二种方法是:

Device device = new Device(0, DeviceType.Default, GetForegroundWindow(), CreateFlags.None, new PresentParameters());
Surface s1 = device.GetBackBuffer(0, BackBufferType.Mono);
device.GetFrontBuffer(s1);

在这两种方法中,设备都会报告找不到 DLL(无法加载 DLL 'netcfd3dm2_0.dll':找不到指定的模块。(HRESULT 异常:0x8007007E))

我对另一篇文章感到困惑。有这方面经验的人可以解决一下吗?

I recently found out about the surface & device class which may solve my problems with screenshoting a fullscreen direct3d game.

I've tried following this article : fastest method to capture game screen shots in c#?(more than20 images per second)

First method i've tried is :

Device device = new Device(0, DeviceType.Default, GetForegroundWindow(), CreateFlags.None, new PresentParameters());
Surface s2 = device.CreateImageSurface(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, Format.A8R8G8B8);
device.GetFrontBuffer(s2);
SurfaceLoader.Save("c:\\Screenshot.bmp", ImageFileFormat.Bmp, s2);

second method i've tried is :

Device device = new Device(0, DeviceType.Default, GetForegroundWindow(), CreateFlags.None, new PresentParameters());
Surface s1 = device.GetBackBuffer(0, BackBufferType.Mono);
device.GetFrontBuffer(s1);

On both methods the device would report a dll it can't find (Unable to load DLL 'netcfd3dm2_0.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E))

I got confused from that other article. Anyone with experience in this area can sort things out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里人 2024-12-09 11:23:43

Seems you missing file that comes with Compact Framework. Try install/reinstall compact framework

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文