Getting Started in Visual Basic .NETByteScout Screen Capturing SDK

The following example demonstrates how to use Screen Capturer ActiveX in Visual Basic .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:

net add reference to capturerlib
VB
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 to .WMV or .AVI
        capturer.OutputFileName = "EntireScreenCaptured.wmv"

        ' set width and height of output video
        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"           


        ' 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