屏幕记录单个窗口
问题描述:
我正在寻找一个SDK,插件或代码,将videorecord特定的窗口(hwnd)。 如果可能的话用C#或Java。有谁知道这是否存在?我一直在使用Google,但没有遇到任何问题。屏幕记录单个窗口
答
安装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();
}
}
}
+0
@Jochen:是否为你工作? – arx
[屏幕的视频记录采用.NET技术]的可能重复(http://stackoverflow.com/questions/397754/record-video-of-screen-using-net-technologies) – Nasreddine
问题出现类似;但不是重复的。有问题的链接是指一般的屏幕截图;这个问题具体指的是捕获屏幕的一部分给定一个特定窗口的HWND。 – IDWMaster
不,这不是重复的。原因如下: 此问题询问如何记录单个窗口,无论窗口是否显示在桌面上或最小化(他提到HWND)。因此,屏幕截图方法在这里不会是答案。答案应该与如何捕获给定窗口句柄的窗口有关。 – thenonhacker