Sample source code below will show you how to cope with a difficult task like capture region into video in VBScript and VB6. What is ByteScout Screen Capturing SDK? It is the tool for developers who want to add screen capturing in their application. Can record screen into video and into single screenshots. Output formats are WMV, AVI, WebM for video and PNG for screenshots. You can adjust output video size, quality, resolution, framerate, video and audio codecs. Includes special privacy features for blacking out sensitive information on screen. Can also capture video from web camera, can add overlays with text or images. It can help you to capture region into video in your VBScript and VB6 application.
The SDK samples like this one below explain how to quickly make your application do capture region into video in VBScript and VB6 with the help of ByteScout Screen Capturing SDK. This VBScript and VB6 sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Enjoy writing a code with ready-to-use sample VBScript and VB6 codes.
Download free trial version of ByteScout Screen Capturing SDK from our website with this and other source code samples for VBScript and VB6.
' create video capturer activex object Set capturer = CreateObject("BytescoutScreenCapturing.Capturer") ' set output video file name (WMV), you can also set to AVI capturer.OutputFileName = "CaptureScreenVbs.wmv" ' set capturing type to the caRegion =0 to capture the given region capturer.CapturingType = 0 ' set left coordinate of the rectangle to capture from capturer.CaptureRectLeft = 100 ' set top coordinate of the rectangle to capture from capturer.CaptureRectTop = 100 ' set width of the rectangle to capture from capturer.CaptureRectWidth = 320 ' set height of the rectangle to capture from capturer.CaptureRectHeight = 240 ' set width of the output video capturer.OutputWidth = 640 ' set height of the output video capturer.OutputHeight = 480 ' set border type to show around captured area capturer.CaptureAreaBorderType = 2 ' CaptureAreaBorderType.cabtDashed; ' 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" ' uncomment to enable recording of semitransparent or layered windows (Warning: may cause mouse cursor flickering) ' capturer.CaptureTransparentControls = true MsgBox "This script will record video from the screen from region (100,100, 420, 350) for 15 seconds. Output video will go to PredefinedRegionCaptured.avi" ' run video capturing capturer.Run() ' IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are ' using Thread.Sleep(1) inside the checking loop, so you have the loop like ' Do ' Thread.Sleep(1) ' While StopButtonNotClicked ' IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are ' using Thread.Sleep(1) inside the checking loop, so you have the loop like ' Do ' Thread.Sleep(1) ' While StopButtonNotClicked ' wait for 15 seconds (15000 msec) WScript.Sleep(15000) ' stop capturing capturer.Stop() ' destroy Capturer object so the video will be saved into the disk Set capturer = Nothing