Free Trial
Web API version
Licensing
Request A Quote
HAVE QUESTIONS OR NEED HELP? SUBMIT THE SUPPORT REQUEST FORM or write email to SUPPORT@BYTESCOUT.COM
The following example demonstrates how to use Screen Capturer ActiveX in Visual C# .NET and capture video from screen into AVI video file.
Before using the code, click Project and Add Reference.., switch to COM tab and select BytescoutScreenCapturingLib in the list of available ActiveX and COM objects and click OK as shown on the screenshot below:

C#
using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Diagnostics; using BytescoutScreenCapturingLib; // import bytescout screen capturing activex object namespace SimpleCaptureCSharp { class Program { static void Main(string[] args) { CapturerClass capturer = new CapturerClass(); // create new screen capturer object capturer.CapturingType = CaptureAreaType.catScreen; // set capturing area type to catScreen to capture whole screen capturer.OutputFileName = "EntireScreenCaptured.wmv"; // set output video filename to .WVM or .AVI filename // set output video width and height capturer.OutputWidth = 640; capturer.OutputHeight = 480; // uncomment to set Bytescout Lossless Video format output video compression method //do not forget to set file to .avi format if you use Video Codec Name //capturer.CurrentVideoCodecName = "Bytescout Lossless"; capturer.Run(); // run screen video capturing Thread.Sleep(15000); // wait for 15 seconds capturer.Stop(); // stop video capturing Process.Start("EntireScreenCaptured.wmv"); } } }