How to record entire screen into a using with Bytescout Screen Capturing SDK - ByteScout

How to record entire screen into a using with Bytescout Screen Capturing SDK

  • Home
  • /
  • Articles
  • /
  • How to record entire screen into a using with Bytescout Screen Capturing SDK

Entire screen recording code sample:

This code sample shows how to use Screen Capturing SDK to record entire screen activity into a video (AVI) with sound. capScreen recording type records the whole desktop screen into a video with the given width and height. Additionaly it records sound (by default) from the default recording line.
This mode can be used if you want to record the entire screen and record voice comments (for what he/she do) from user.

1) Visual Basic .NET

Create new VB.NET Console project in Visual Studio. Click Project | Add Reference.. and add the reference to Bytescout Screen Capturing Lib on the COM tab and click OK. Then use the code snippet below:

Imports System.Threading
    Imports System.Diagnostics

    Imports BytescoutScreenCapturingLib ' import bytescout screen capturer activex object

    Module Module1

      Sub Main()
      ' create capturer class
        Dim capturer As New CapturerClass()
      ' set capturing area to the region type (to capture from given region on the screen)
        capturer.CapturingType = CaptureAreaType.catScreen
      ' output video filename
        capturer.OutputFileName = "EntireScreenCaptured.avi"

        ' set width and height of output video
        capturer.OutputWidth = 320
        capturer.OutputHeight = 240

        ' start capturing
        capturer.Run()

        ' wait for 25 seconds
        Thread.Sleep(25000)

        ' stop capturing and flush AVI video file into the disk
        capturer.Stop()

        ' open the output video
        Process.Start("EntireScreenCaptured.avi")

      End Sub

    End Module

2) Visual C# .NET

Create new C# Console project in Visual Studio. Click Project | Add Reference.. and add the reference to Bytescout Screen Capturing Lib on the COM tab and click OK. Then use the code snippet below:

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.avi"; // set output video filename

          // set output video width and height
          capturer.OutputWidth = 320;
          capturer.OutputHeight = 240;

          capturer.Run(); // run screen video capturing

          Thread.Sleep(15000); // wait for 15 seconds

          capturer.Stop(); // stop video capturing

          Process.Start("EntireScreenCaptured.avi");
        }
      }
    }

3) Visual Basic 6 and VBScript (VBS)

' create video capturer activex object
    Set capturer = CreateObject("BytescoutScreenCapturing.Capturer")

    ' set output video file name
    capturer.OutputFileName = "EntireScreenCaptured.avi"

    ' set capturing type to the caScreen =3 to capture the entire screen
    capturer.CapturingType = 3

    ' output video width
    capturer.OutputWidth = 320

    ' output video height
    capturer.OutputHeight = 320

    MsgBox "This script will record 320x240 video from entire screen for 10 seconds. Output video will go to EntireScreenCaptured.avi"

    ' run video capturing
    capturer.Run()

    ' wait for 10 seconds (10000 msec)
    WScript.Sleep(10000)

    ' stop capturing
    capturer.Stop()

    ' destroy Capturer object so the video will be saved into the disk
    Set capturer = Nothing

Tutorials:

prev
next