ByteScout Image To Video SDK – VB.NET – Conversion Progress GUI

  • Home
  • /
  • Articles
  • /
  • ByteScout Image To Video SDK – VB.NET – Conversion Progress GUI

ByteScout Image To Video SDK – VB.NET – Conversion Progress GUI


Imports System.Windows.Forms

Imports BytescoutImageToVideo

Public Partial Class Form1
	Inherits Form
	Public Const WM_APP As Integer = &H8000
	Public Const WM_CONVERSION_PROGRESS As Integer = WM_APP + 1

	Private converter As New ImageToVideo()

	Public Sub New()

		converter.RegistrationName = "demo"
		converter.RegistrationKey = "demo"

	End Sub

    Private Sub buttonConvert_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttonConvert.Click
        If Not converter.IsRunning Then

            ' Set default "in" effect for slides (you can also set effects for each single slide)
            converter.Slides.DefaultSlideInEffect = 1 ' teFadeIn (1) - fades in effect for slides transition
            converter.Slides.DefaultSlideInEffectDuration = 500 ' 500 msec for in effect

            ' Add images and set the duration for every slide
            Dim slide As Slide
            slide = converter.AddImageFromFileName("..\..\..\..\slide1.jpg")
            slide.Duration = 3000 ' 3000ms = 3s
            slide = converter.AddImageFromFileName("..\..\..\..\slide2.jpg")
            slide.Duration = 3000
            slide = converter.AddImageFromFileName("..\..\..\..\slide3.jpg")
            slide.Duration = 3000

            ' Set output video size
            converter.OutputWidth = 400
            converter.OutputHeight = 300

            ' Set output video file name
            converter.OutputVideoFileName = "result.wmv"

            ' Set progress notification target window
            converter.SetProgressNotifyWindow(Handle.ToInt32(), WM_CONVERSION_PROGRESS, 0)

            ' Run the conversion
        End If
    End Sub

    Protected Overloads Overrides Sub WndProc(ByRef m As Message)

        If m.HWnd = Handle AndAlso m.Msg = WM_CONVERSION_PROGRESS Then
            progressBar1.Value = m.WParam.ToInt32()
        End If

    End Sub
End Class


Imports System.Windows.Forms

NotInheritable Class Program
	Private Sub New()
	End Sub

    <STAThread()> _
 Friend Shared Sub Main()
        Application.Run(New Form1())
    End Sub
End Class

  Click here to get your Free Trial version of the SDK