gpt4 book ai didi

c# - 屏幕录制单个窗口

转载 作者:太空狗 更新时间:2023-10-29 21:46:35 29 4
gpt4 key购买 nike

我正在寻找可以录制特定窗口 (hwnd) 的 SDK、插件或代码。如果可能,在 C# 或 Java 中。有谁知道这是否存在?我一直在谷歌搜索,但没有发现任何东西。

最佳答案

安装 Microsoft Expression Encoder 4 with Service Pack 2 (SP2) .

这是一个使用它的示例程序。 SDK 附带了一个更完整的示例,它包含在下载中。

using System;
using System.Drawing;
using Microsoft.Expression.Encoder.ScreenCapture;

// Added references to:
// Microsoft.Expression.Encoder
// Microsoft.Expression.Encoder.Types
// Microsoft.Expression.Encoder.Utilities
// WindowsBase
// System.Drawing (for Rectangle)

namespace scrcap
{
class Program
{
static void Main(string[] args)
{
ScreenCaptureJob job = new ScreenCaptureJob();

// You can capture a window by setting its coordinates here
job.CaptureRectangle = new Rectangle(100, 100, 200, 200);

// Include the mouse pointer in the captured video
job.CaptureMouseCursor = true;

// Output file; you can transcode the xesc file to something else later.
// Note that this silently does nothing if the file already exists.
job.OutputScreenCaptureFileName = @"C:\Users\arx\scrcap\capture.xesc";

// Do some capture
job.Start();
// Wait for a keypress
Console.ReadKey();
// And stop
job.Stop();
}
}
}

关于c# - 屏幕录制单个窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8281022/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com