LAMPIRAN
Kode Program Menu Awal
Public Class FrmMenu
Private Sub BtnBilangan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBilangan.Click
FrmKonversiBilangan.Visible = True FrmKonversiVideo.Visible = False FrmKonversiAudio.Visible = False FrmKonversiGambar.Visible = False FrmTxtKePdf.Visible = False
Me.Visible = False End Sub
Private Sub BtnVideo_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnVideo.Click
' PnlKonversiVideo.Visible = True ' PnlKonversiAudio.Visible = False FrmKonversiVideo.Visible = True
FrmKonversiBilangan.Visible = False FrmKonversiAudio.Visible = False FrmKonversiGambar.Visible = False FrmTxtKePdf.Visible = False
Me.Visible = False End Sub
Private Sub BtnAudio_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnAudio.Click
' PnlKonversiAudio.Visible = True ' PnlKonversiVideo.Visible = False FrmKonversiAudio.Visible = True
FrmKonversiVideo.Visible = False FrmKonversiBilangan.Visible = False FrmKonversiGambar.Visible = False FrmTxtKePdf.Visible = False
Me.Visible = False End Sub
Private Sub BtnGambar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGambar.Click
FrmKonversiBilangan.Visible = False FrmTxtKePdf.Visible = False
Me.Visible = False End Sub
Private Sub BtnDokumen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDokumen.Click
FrmKonvertDokumen.Visible = True FrmTxtKePdf.Visible = False
FrmKonversiGambar.Visible = False FrmKonversiAudio.Visible = False FrmKonversiVideo.Visible = False FrmKonversiBilangan.Visible = False Me.Visible = False
End Sub
Private Sub BtnTentang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTentang.Click
FrmTxtKePdf.Visible = False
FrmKonversiGambar.Visible = False FrmKonversiAudio.Visible = False FrmKonversiVideo.Visible = False FrmKonversiBilangan.Visible = False FrmTentang.Visible = True
Me.Visible = False End Sub
Private Sub BtnExit_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnExit.Click
Dim keluar As MsgBoxResult
keluar = MsgBox("Apakah Anda Yakin Ingin Keluar
Dari Aplikasi Ini?", MsgBoxStyle.YesNo, "Peringatan")
If keluar = MsgBoxResult.Yes Then Close()
End If End Sub End Class
Kode Program Menu Konversi Audio
Imports System.IO
Public Class FrmKonversiAudio
Dim proc As New Process
Function startConversion()
Dim input As String = Me.dlgOpenAudio.FileName Dim output As String = Me.dlgSaveAudio.FileName Dim exepath As String = Application.StartupPath + "\bin\ffmpeg.exe"
Dim quality As Integer = TrackBarAudio.Value * 2
Dim startinfo As New
System.Diagnostics.ProcessStartInfo
Dim sr As StreamReader
Dim cmd As String = " -i """ + input + """ -ar 22050 -qscale " & quality & " -y """ + output + """" Dim ffmpegOutput As String
startinfo.FileName = exepath startinfo.Arguments = cmd
startinfo.UseShellExecute = False startinfo.WindowStyle =
ProcessWindowStyle.Hidden
startinfo.RedirectStandardError = True startinfo.RedirectStandardOutput = True startinfo.CreateNoWindow = True
proc.StartInfo = startinfo proc.Start()
Me.lblInfoAudio.Text = "Lagi Proses Pengkonversian... Silahkan Tunggu..."
sr = proc.StandardError
Me.btnStartAudio.Enabled = False Do
If
BackgroundWorkerAudio.CancellationPending Then End If
ffmpegOutput = sr.ReadLine
Me.txtProgressAudio.Text = ffmpegOutput Loop Until proc.HasExited And ffmpegOutput = Nothing Or ffmpegOutput = ""
Me.txtProgressAudio.Text = "Selesai" Me.lblInfoAudio.Text = "Telah Selesai!" MsgBox("Telah Selesai!",
MsgBoxStyle.Exclamation)
Me.btnStartAudio.Enabled = True Return 0
End Function
Private Sub btnStart_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnStartAudio.Click
MsgBox("Pilih Terlebih Dahulu File Yang
Akan Dikonver", MsgBoxStyle.Information, "Pilih Sebuah
file")
Exit Sub
ElseIf txtSaveAudio.Text = "" Or
txtSaveAudio.Text <> dlgSaveAudio.FileName Then MsgBox("Pilih Terlebih Dahulu Lokasi
Penyimpanan File", MsgBoxStyle.Information, "Pilih
Sebuah file")
Exit Sub End If
BackgroundWorkerAudio.RunWorkerAsync() End Sub
Private Sub dlgSave_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgSaveAudio.FileOk
dlgSaveAudio.OverwritePrompt = True dlgSaveAudio.DereferenceLinks = True dlgSaveAudio.CreatePrompt = True dlgSaveAudio.Filter =
"(*.mp2)|*.mp2|(*.mp3)|*.mp3|(*.wav)|*.wav"
txtSaveAudio.Text = dlgSaveAudio.FileName End Sub
Private Sub btnSave_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnSaveAudio.Click
dlgSaveAudio.ShowDialog() End Sub
Private Sub btnOpen_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnOpenAudio.Click
dlgOpenAudio.ShowDialog() End Sub
Private Sub dlgOpen_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgOpenAudio.FileOk
dlgOpenAudio.CheckFileExists = True
txtOpenAudio.Text = dlgOpenAudio.FileName
Private Sub btnStop_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnStopAudio.Click
On Error GoTo handle
BackgroundWorkerAudio.CancelAsync() If btnStartAudio.Enabled = False Then lblInfoAudio.Text = ("Konversi Dibatalkan!")
MsgBox("Konversi Akan Dibatalkan",
MsgBoxStyle.Exclamation)
btnStartAudio.Enabled = True Else
MsgBox("Konversi Dimulai",
MsgBoxStyle.Critical) End If
proc.Kill() handle:
Exit Sub End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As
System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorkerAudio.DoWork
startConversion() End Sub
Private Sub btnHome_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnHomeAudio.Click
Me.Visible = False FrmMenu.Visible = True End Sub
End Class
Kode Program Menu Konversi Bilangan
Public Class FrmKonversiBilangan
Private Sub Form1_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
rdoBiDe.Checked = False rdoBiDe.Checked = True End Sub
Private Sub rdoBiDe_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoBiDe.CheckedChanged
lblHasil.Text = ""
txtBilangan.MaxLength = 30
If rdoBiDe.Checked = True Then BtnBiDe.Enabled = True BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = False BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then
If Not cControl.Name.ToString = "Button1" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then
If Not cControl.Name.ToString = "Button1" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoDeBi_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoDeBi.CheckedChanged
txtBilangan.MaxLength = 9 txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = True BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = False BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
If rdoDeBi.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button2" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button2" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub txtBilangan_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBilangan.TextChanged
If rdoBiDe.Checked = True And
txtBilangan.Text.Length > 0 Or rdoBiHex.Checked = True And txtBilangan.Text.Length > 0 Or rdoBiOk.Checked = True And txtBilangan.Text.Length > 0 Then
Dim u As Integer = 0
For u = 0 To p - 1 If p > 0 Then
Dim a As String = txtBilangan.Text.Substring(p - 1, 1)
If a = "1" Or a = "0" Then Else
Dim s As String = txtBilangan.Text.Remove(p - 1, 1)
txtBilangan.Text = s End If
p = p - 1 End If
Next End If
If rdoDeBi.Checked = True And
txtBilangan.Text.Length > 0 Or rdoDeHex.Checked = True And txtBilangan.Text.Length > 0 Or rdoDeOk.Checked = True And txtBilangan.Text.Length > 0 Then
Dim u As Integer = 0
Dim p As Integer = txtBilangan.Text.Length For u = 0 To p - 1
If p > 0 Then
Dim a As String = txtBilangan.Text.Substring(p - 1, 1) If IsNumeric(a) Then Else
Dim s As String = txtBilangan.Text.Remove(p - 1, 1)
txtBilangan.Text = s End If
p = p - 1 End If
Next End If
If rdoOkBi.Checked = True And
txtBilangan.Text.Length > 0 Or rdoOkHex.Checked = True And txtBilangan.Text.Length > 0 Or rdoOkDe.Checked = True And txtBilangan.Text.Length > 0 Then
Dim u As Integer = 0
Dim p As Integer = txtBilangan.Text.Length For u = 0 To p - 1
If p > 0 Then
Dim a As String = txtBilangan.Text.Substring(p - 1, 1)
If a = "0" Or a = "1" Or a = "2" Or a = "3" Or a = "4" Or a = "5" Or _
Dim s As String = txtBilangan.Text.Remove(p - 1, 1)
txtBilangan.Text = s End If
p = p - 1 End If
Next End If
If rdoHexBi.Checked = True And
txtBilangan.Text.Length > 0 Or rdoHexDe.Checked = True And txtBilangan.Text.Length > 0 Or rdoHexOk.Checked = True And txtBilangan.Text.Length > 0 Then
Dim u As Integer = 0
Dim p As Integer = txtBilangan.Text.Length For u = 0 To p - 1
If p > 0 Then
Dim a As String = txtBilangan.Text.Substring(p - 1, 1)
If IsNumeric(a) Or a = "a" Or a = "b" Or a = "c" Or a = "d" Or a = "e" Or a = "f" _
Or a = "A" Or a = "B" Or a = "C" Or a = "D" Or a = "E" Or a = "F" Then
Else
Dim s As String = txtBilangan.Text.Remove(p - 1, 1)
txtBilangan.Text = s End If
p = p - 1 End If
Next End If End Sub
Private Sub rdoBiHex_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoBiHex.CheckedChanged
txtBilangan.Clear() lblHasil.Text = ""
67
BtnOcDe.Enabled = False BtnOcHe.Enabled = False
If rdoBiHex.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button3" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button3" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoHexDe_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoHexDe.CheckedChanged
txtBilangan.Clear() lblHasil.Text = ""
txtBilangan.MaxLength = 10 txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = False BtnDeOc.Enabled = False BtnHeDe.Enabled = True BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button9" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button9" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoHexBi_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoHexBi.CheckedChanged
txtBilangan.MaxLength = 10 txtBilangan.Clear()
lblHasil.Text = ""
txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = True BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = False BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
If rdoHexBi.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If Not cControl.Name.ToString = "Button4" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button4" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub Timer1_Tick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Label4.Text.Length >= 23 Then Label4.Text = ""
Else
Dim randBinary As New Random
Dim randbin As Integer = randBinary.Next(0, 2)
Label4.Text = Label4.Text + randbin.ToString
End If End Sub
Private Sub rdoBiOk_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoBiOk.CheckedChanged
txtBilangan.Clear() lblHasil.Text = ""
BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
If rdoBiOk.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button5" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button5" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoHexOk_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoHexOk.CheckedChanged
txtBilangan.MaxLength = 10 txtBilangan.Clear()
lblHasil.Text = ""
If rdoHexOk.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button10" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button10" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoDeHex_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoDeHex.CheckedChanged
txtBilangan.MaxLength = 9 txtBilangan.Clear()
lblHasil.Text = ""
txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = True BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
If rdoDeHex.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If Not cControl.Name.ToString = "Button7" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button7" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoDeOk_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoDeOk.CheckedChanged
txtBilangan.MaxLength = 9 txtBilangan.Clear()
lblHasil.Text = ""
txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = False BtnDeOc.Enabled = True BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
If rdoDeOk.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button8" And Not cControl.Name.ToString = "Button13" Then
End If End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button8" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoOkBi_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoOkBi.CheckedChanged
txtBilangan.Clear() lblHasil.Text = ""
txtBilangan.MaxLength = 10 txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = True BtnDeHe.Enabled = False BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = False
If rdoOkBi.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button6" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button6" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoOkDe_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoOkDe.CheckedChanged
txtBilangan.Clear() lblHasil.Text = ""
txtBilangan.MaxLength = 10 txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = False BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = True BtnOcHe.Enabled = False
If rdoOkDe.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button11" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If Not cControl.Name.ToString = "Button11" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = True End If
End If Next cControl End If
End Sub
Private Sub rdoOkHex_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoOkHex.CheckedChanged
txtBilangan.Clear() lblHasil.Text = ""
txtBilangan.MaxLength = 10 txtBilangan.MaxLength = 30 BtnBiDe.Enabled = False BtnDeBi.Enabled = False BtnBiHe.Enabled = False BtnHeBi.Enabled = False BtnBiOc.Enabled = False BtnOcBi.Enabled = False BtnDeHe.Enabled = False BtnDeOc.Enabled = False BtnHeDe.Enabled = False BtnHeOc.Enabled = False BtnOcDe.Enabled = False BtnOcHe.Enabled = True
If rdoOkHex.Checked = True Then Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button12" And Not cControl.Name.ToString = "Button13" Then
cControl.Enabled = False End If
End If Next cControl Else
Dim cControl As Control
For Each cControl In Me.Controls
If (TypeOf cControl Is Button) Then If Not cControl.Name.ToString = "Button12" And Not cControl.Name.ToString = "Button13" Then
End If End If Next cControl End If
End Sub
Private Sub Button13_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button13.Click
lstHasil.Items.Clear() txtBilangan.Text = "" lblHasil.Text = "" End Sub
Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Clipboard.SetDataObject(lblHasil.Text, True) End Sub
Private Sub BtnBiDe_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnBiDe.Click
If IsNumeric(txtBilangan.Text) Then Dim result As Integer
Dim binary As String = txtBilangan.Text result = Convert.ToInt32(binary, 2) lblHasil.Text = result
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Binary to Decimal " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnBiHe_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnBiHe.Click
If IsNumeric(txtBilangan.Text) Then Dim result As Integer
Dim binary As String = txtBilangan.Text result = Convert.ToInt32(binary, 2) lblHasil.Text = Hex(result)
lstHasil.Items.Add("Dikonversikan: " +
67
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnBiOc_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnBiOc.Click
If IsNumeric(txtBilangan.Text) Then Dim result As Integer
Dim binary As String = txtBilangan.Text result = Convert.ToInt32(binary, 2) lblHasil.Text = Oct(result)
lstHasil.Items.Add("Dikonversikan: " +
Date.Now.ToLongTimeString.ToString + " Binary to Octal " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnOcBi_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnOcBi.Click
If IsNumeric(txtBilangan.Text) Then Dim strOctal As String
strOctal = txtBilangan.Text
Dim lngValue As Integer = CLng("&O" & strOctal)
Dim decimal1 As Integer = lngValue Dim result As String = ""
result = Convert.ToString(decimal1, 2) lblHasil.Text = result
lstHasil.Items.Add("Dikonversikan: " +
Date.Now.ToLongTimeString.ToString + " Octal To Binary " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
Private Sub BtnOcDe_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnOcDe.Click
If IsNumeric(txtBilangan.Text) Then Dim strOctal As String
strOctal = txtBilangan.Text Dim lngValue As Integer
lngValue = CLng("&O" & strOctal) lblHasil.Text = lngValue.ToString
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Octal To Decimal " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnOcHe_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnOcHe.Click
If IsNumeric(txtBilangan.Text) Then Dim strOctal As String
strOctal = txtBilangan.Text Dim lngValue As Integer
lngValue = CLng("&O" & strOctal) lblHasil.Text = Hex(lngValue)
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Octal To Hex " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnDeBi_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnDeBi.Click
If IsNumeric(txtBilangan.Text) Then
Dim decimal1 As Integer = txtBilangan.Text Dim result As String = ""
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Decimal To Binary " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnDeHe_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnDeHe.Click
If IsNumeric(txtBilangan.Text) Then
Dim decimal1 As Integer = txtBilangan.Text Dim result As String = ""
result = Convert.ToString(decimal1, 2) Dim result1 As Integer
Dim binary As String = result
result1 = Convert.ToInt32(binary, 2) lblHasil.Text = Hex(result1)
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Decimal To Hex " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnDeOc_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnDeOc.Click
If IsNumeric(txtBilangan.Text) Then
Dim result As Integer = txtBilangan.Text lblHasil.Text = Oct(result)
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Decimal To Octal " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
Private Sub BtnHeBi_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnHeBi.Click
If txtBilangan.Text.Length > 0 Then
Dim hex As String = txtBilangan.Text Dim dec As Int64 =
System.Convert.ToInt64(hex, 16) If IsNumeric(dec) Then
Dim decimal1 As Int64 = dec Dim result As String = ""
result = Convert.ToString(decimal1, 2) lblHasil.Text = result
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Hex To Binary " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("") lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End If End Sub
Private Sub BtnHeDe_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnHeDe.Click
If txtBilangan.Text.Length > 0 Then
Dim hex As String = txtBilangan.Text Dim dec As Int64 =
System.Convert.ToInt64(hex, 16)
lblHasil.Text = dec.ToString
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Hex To Decimal " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub BtnHeOc_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles BtnHeOc.Click
Dim dec As Int64 = System.Convert.ToInt64(hex, 16)
lblHasil.Text = Oct(dec)
lstHasil.Items.Add("Dikonversikan: " + Date.Now.ToLongTimeString.ToString + " Hex To Octal " + txtBilangan.Text)
lstHasil.Items.Add("Hasil Konversi:" + " " + lblHasil.Text)
lstHasil.Items.Add("")
lstHasil.TopIndex = lstHasil.Items.Count - 1
End If End Sub
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Visible = False FrmMenu.Visible = True End Sub
End Class
Kode Program Menu Konversi Dokumen
List 1
Public Class FrmKonvertDokumen
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button1.Click
FrmTxtKePdf.Show() Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button2.Click
frmOfficeKePdf.show() Me.Visible = False End Sub
Private Sub Button3_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Visible = False FrmMenu.Show() End Sub
List 2
Imports iTextSharp
Imports iTextSharp.text Imports iTextSharp.text.pdf Imports System.IO
Public Class FrmTxtKePdf
Private Sub btHapusText_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btHapusText.Click
txtText.Text = "" End Sub
Private Sub btCariText_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btCariText.Click
dlgOpen.CheckFileExists = True dlgOpen.CheckPathExists = True dlgOpen.Multiselect = False dlgOpen.DefaultExt = "txt" dlgOpen.FileName = ""
dlgOpen.Filter = "Archive Text (*.txt)|*.txt|All Archive(*.*)|*.*"
dlgOpen.Title = "Konvert Text ke Pdf" If dlgOpen.ShowDialog =
Windows.Forms.DialogResult.OK Then Dim objFichero As New _
System.IO.StreamReader(dlgOpen.FileName, System.Text.Encoding.Default)
txtText.Text = objFichero.ReadToEnd End If
End Sub
Private Sub btKonvert_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btKonvert.Click
If txtText.Text = "" Then
MsgBox("Isi Terlebih Dahulu Text Atau Cari",
MsgBoxStyle.Exclamation +
MsgBoxStyle.OkOnly)
txtText.Focus() Else
MsgBox("Tentukan Lokasi Penyimpanan", MsgBoxStyle.Exclamation +
MsgBoxStyle.OkOnly)
txtLokasiPDF.Focus() Else
Try
Dim documentoPDF As New Document
PdfWriter.GetInstance(documentoPDF, New
FileStream(txtLokasiPDF.Text, FileMode.Create)) documentoPDF.Open()
documentoPDF.Add(New
Paragraph(txtText.Text,
FontFactory.GetFont(FontFactory.TIMES, 11,
iTextSharp.text.Font.NORMAL)))
documentoPDF.AddAuthor(txtAutor.Text)
documentoPDF.AddCreator("Konvert text ke pdf")
documentoPDF.AddKeywords(txtPerusahaan.Text)
documentoPDF.AddSubject(txtPembuat.Text)
documentoPDF.AddTitle(txtTitle.Text)
documentoPDF.AddCreationDate() documentoPDF.Close()
If
System.IO.File.Exists(txtLokasiPDF.Text) Then
If MsgBox("Konversi text ke pdf telah berhasil, Apakah ingin membuka file tersebut??", MsgBoxStyle.Question +
MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
System.Diagnostics.Process.Start(txtLokasiPDF.Text) End If
Else
MsgBox("File PDF tidak dihasilkan, " + _
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Ada kesalahan saat mencoba untuk mengubah teks ke PDF: " + _
vbCrLf + vbCrLf + ex.Message, MsgBoxStyle.Critical +
MsgBoxStyle.OkOnly) End Try End If
End If End Sub
Private Sub btSave_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btSave.Click
dlgSave.CheckFileExists = False dlgSave.CheckPathExists = True dlgSave.DefaultExt = "txt" dlgSave.FileName = ""
dlgSave.Filter = "Archive PDF (*.pdf)|*.pdf|All Archive(*.*)|*.*"
dlgSave.Title = "Judul Dari PDF" If dlgSave.ShowDialog =
Windows.Forms.DialogResult.OK Then
txtLokasiPDF.Text = dlgSave.FileName End If
End Sub
Private Sub FrmDokumen_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
txtLokasiPDF.Text =
System.IO.Path.Combine(System.Environment.GetFolderPath (
Environment.SpecialFolder.MyDocuments), "dokumen.pdf")
End Sub
Private Sub btnHome_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnHome.Click
Me.Visible = False
End Class
List 3
Imports System Imports System.IO Imports System.Text
Imports System.Collections
Public Class FrmOfficeKePdf
Dim u As New SautinSoft.UseOffice
Private Sub dlgSavedoc_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgSavedoc.FileOk
dlgSavedoc.OverwritePrompt = True dlgSavedoc.DereferenceLinks = True dlgSavedoc.CreatePrompt = True
dlgSavedoc.Filter = "(*.pdf)|*.pdf" txtSave.Text = dlgSavedoc.FileName End Sub
Private Sub dlgOpendoc_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgOpendoc.FileOk
dlgOpendoc.CheckFileExists = True txtOpen.Text = dlgOpendoc.FileName End Sub
Private Sub btnOpen_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
dlgOpendoc.ShowDialog() End Sub
Private Sub btnSave_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
dlgSavedoc.ShowDialog() End Sub
Private Sub Button8_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim f As New SautinSoft.UseOffice
Dim ret As Integer = u.InitWord()
If txtOpen.Text = "" Or txtOpen.Text <> dlgOpendoc.FileName Then
MsgBox("Pilih Terlebih Dahulu File Yang
Akan Dikonver", MsgBoxStyle.Information, "Pilih File")
Exit Sub
ElseIf txtSave.Text = "" Or txtSave.Text <> dlgSavedoc.FileName Then
MsgBox("Pilih Terlebih Dahulu Lokasi
Penyimpanan File", MsgBoxStyle.Information, "Pilih
Penyimapan")
Exit Sub End If
ret = u.ConvertFile(inputFilePath, outputFilePath,
SautinSoft.UseOffice.eDirection.DOC_to_PDF) u.CloseWord()
If ret = 0 Then
If System.IO.File.Exists(txtSave.Text) Then If MsgBox("Konversi doc ke pdf telah berhasil, Apakah ingin membuka file tersebut??",
MsgBoxStyle.Question +
MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
System.Diagnostics.Process.Start(txtSave.Text) End If
End If End If End Sub
'---docx to pdf
Private Sub dlgSavedocx_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgSavedocx.FileOk
dlgSavedocx.OverwritePrompt = True dlgSavedocx.DereferenceLinks = True dlgSavedocx.CreatePrompt = True
dlgSavedocx.Filter = "(*.pdf)|*.pdf" txtSave1.Text = dlgSavedocx.FileName End Sub
Private Sub dlgOpendocx_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgOpendocx.FileOk
Private Sub btnOpen1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnOpen1.Click
dlgOpendocx.ShowDialog() End Sub
Private Sub btnSave1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnSave1.Click
dlgSavedocx.ShowDialog() End Sub
Private Sub btnKonvert1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKonvert1.Click
Dim f As New SautinSoft.UseOffice
Dim inputFilePath As String = txtOpen1.Text Dim outputFilePath As String = txtSave1.Text Dim ret As Integer = u.InitWord()
If txtOpen1.Text = "" Or txtOpen1.Text <> dlgOpendocx.FileName Then
MsgBox("Pilih Terlebih Dahulu File Yang
Akan Dikonver", MsgBoxStyle.Information, "Pilih File")
Exit Sub
ElseIf txtSave1.Text = "" Or txtSave1.Text <> dlgSavedocx.FileName Then
MsgBox("Pilih Terlebih Dahulu Lokasi
Penyimpanan File", MsgBoxStyle.Information, "Pilih
Penyimapan")
Exit Sub End If
ret = u.ConvertFile(inputFilePath, outputFilePath,
SautinSoft.UseOffice.eDirection.DOCX_to_PDF) u.CloseWord()
If ret = 0 Then
If System.IO.File.Exists(txtSave1.Text) Then
If MsgBox("Konversi docx ke pdf telah berhasil, Apakah ingin membuka file tersebut??",
MsgBoxStyle.Question +
MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
System.Diagnostics.Process.Start(txtSave1.Text) End If
End If End If End Sub
Private Sub dlgSavexlsx_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgSavexlsx.FileOk
dlgSavexlsx.OverwritePrompt = True dlgSavexlsx.DereferenceLinks = True dlgSavexlsx.CreatePrompt = True
dlgSavexlsx.Filter = "(*.pdf)|*.pdf" txtSave2.Text = dlgSavexlsx.FileName End Sub
Private Sub dlgOpenxlsx_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgOpenxlsx.FileOk
dlgOpenxlsx.CheckFileExists = True txtOpen2.Text = dlgOpenxlsx.FileName End Sub
Private Sub btnOpen2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnOpen2.Click
dlgOpenxlsx.ShowDialog() End Sub
Private Sub btnSave2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnSave2.Click
dlgSavexlsx.ShowDialog() End Sub
Private Sub btnKonvert2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKonvert2.Click
Dim f As New SautinSoft.UseOffice
Dim inputFilePath As String = txtOpen2.Text Dim outputFilePath As String = txtSave2.Text Dim ret As Integer = u.InitWord()
If txtOpen2.Text = "" Or txtOpen2.Text <> dlgOpenxlsx.FileName Then
MsgBox("Pilih Terlebih Dahulu File Yang
Akan Dikonver", MsgBoxStyle.Information, "Pilih File")
Exit Sub
ElseIf txtSave2.Text = "" Or txtSave2.Text <> dlgSavexlsx.FileName Then
MsgBox("Pilih Terlebih Dahulu Lokasi
Penyimpanan File", MsgBoxStyle.Information, "Pilih
Penyimapan")
ret = u.ConvertFile(inputFilePath, outputFilePath,
SautinSoft.UseOffice.eDirection.XLSX_to_PDF) u.CloseWord()
If ret = 0 Then
If System.IO.File.Exists(txtSave2.Text) Then
If MsgBox("Konversi xlsx ke pdf telah berhasil, Apakah ingin membuka file tersebut??",
MsgBoxStyle.Question +
MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
System.Diagnostics.Process.Start(txtSave2.Text) End If
End If End If End Sub
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Visible = False FrmMenu.Show() End Sub
End Class
Kode Program Menu Konversi Gambar
Public Class FrmKonversiGambar
Private Sub FrmKonversiGambar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmbFormats.SelectedItem = "BMP" End Sub
Private Sub btnOpenImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenImage.Click
Try
Static i As Integer = 0 If ofdPicture.ShowDialog <> Windows.Forms.DialogResult.Cancel Then For Each f As String In ofdPicture.FileNames
DaftarFiles.Rows.Insert(i)
DaftarFiles.Rows(i).SetValues(f) i += 1
i = 0
Catch ex As Exception
MsgBox(ex.ToString) End Try
End Sub
Private Sub DaftarFiles_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) If DaftarFiles.SelectedRows.Count > 0 Then pbPreview.Image =
Image.FromFile(DaftarFiles.Item(0,
DaftarFiles.SelectedRows.Item(0).Index).Value) End If
End Sub
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
If DaftarFiles.SelectedRows.Count > 0 Then
DaftarFiles.Rows.RemoveAt(DaftarFiles.SelectedRows.Item (0).Index)
End If End Sub
Private Sub btnClearList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearList.Click
If DaftarFiles.Rows.Count > 0 Then DaftarFiles.Rows.Clear()
End If End Sub
Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
If DaftarFiles.Rows.Count > 0 And
fbdPicture.ShowDialog <> DialogResult.Cancel Then Dim j As Integer = 0
Dim spath As String = "" Dim fpath As String = fbdPicture.SelectedPath
For j = 0 To DaftarFiles.Rows.Count - 1 spath = fpath & "\" &
DaftarFiles.Item(0,
j).Value.ToString.Substring(DaftarFiles.Item(0, j).Value.ToString.LastIndexOf("\") + 1,
- DaftarFiles.Item(0,
j).Value.ToString.LastIndexOf("\")) - 1) pbPreview.Image =
Image.FromFile(DaftarFiles.Item(0, j).Value.ToString) If cmbFormats.SelectedItem = "BMP" Then pbPreview.Image.Save(spath & ".bmp",
System.Drawing.Imaging.ImageFormat.Bmp)
If cmbFormats.SelectedItem = "PNG" Then pbPreview.Image.Save(spath & ".png",
System.Drawing.Imaging.ImageFormat.Png)
If cmbFormats.SelectedItem = "GIF" Then pbPreview.Image.Save(spath & ".gif",
System.Drawing.Imaging.ImageFormat.Gif)
If cmbFormats.SelectedItem = "TIFF" Then pbPreview.Image.Save(spath & ".tiff",
System.Drawing.Imaging.ImageFormat.Tiff)
If cmbFormats.SelectedItem = "JPG" Then pbPreview.Image.Save(spath & ".jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
If cmbFormats.SelectedItem = "ICO" Then pbPreview.Image.Save(spath & ".ico",
System.Drawing.Imaging.ImageFormat.Icon) spath = ""
Next j = 0 End If End Sub
Private Sub btnHome_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnHome.Click
Me.Visible = False FrmMenu.Visible = True End Sub
End Class
Kode Program Menu Konversi Video
Imports System.IO
Public Class FrmKonversiVideo
Dim proc As New Process
Function startConversion()
Control.CheckForIllegalCrossThreadCalls = False Dim input As String = Me.dlgOpenVideo.FileName Dim output As String = Me.dlgSaveVideo.FileName Dim exepath As String = Application.StartupPath + "\bin\ffmpeg.exe"
Dim startinfo As New
System.Diagnostics.ProcessStartInfo
Dim sr As StreamReader
Dim cmd As String = " -i """ + input + """ -ar 22050 -qscale " & quality & " -y """ + output + """" 'ffmpeg commands -y replace
Dim ffmpegOutput As String
startinfo.FileName = exepath startinfo.Arguments = cmd
startinfo.UseShellExecute = False startinfo.WindowStyle =
ProcessWindowStyle.Hidden
startinfo.RedirectStandardError = True startinfo.RedirectStandardOutput = True startinfo.CreateNoWindow = True
proc.StartInfo = startinfo proc.Start()
Me.lblInfoVideo.Text = "Lagi Proses Pengkonversian... Silahkan Tunggu..."
sr = proc.StandardError
Me.btnStartVideo.Enabled = False Do
If
BackgroundWorkerVideo.CancellationPending Then End If
ffmpegOutput = sr.ReadLine
Me.txtProgressVideo.Text = ffmpegOutput Loop Until proc.HasExited And ffmpegOutput = Nothing Or ffmpegOutput = ""
Me.txtProgressVideo.Text = "Selesai!" Me.lblInfoVideo.Text = "Telah Selesai!" MsgBox("Telah Selesai!",
MsgBoxStyle.Exclamation)
Me.btnStartVideo.Enabled = True Return 0
End Function
Private Sub btnStart_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnStartVideo.Click
If txtOpenVideo.Text = "" Or txtOpenVideo.Text <> dlgOpenVideo.FileName Then
MsgBox("Pilih Terlebih Dahulu File Yang
Akan Dikonver", MsgBoxStyle.Information, "Pilih File")
ElseIf txtSaveVideo.Text = "" Or
txtSaveVideo.Text <> dlgSaveVideo.FileName Then MsgBox("Pilih Terlebih Dahulu Lokasi
Penyimpanan File", MsgBoxStyle.Information, "Pilih
Penyimapan")
Exit Sub End If
BackgroundWorkerVideo.RunWorkerAsync() End Sub
Private Sub dlgSave_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgSaveVideo.FileOk
dlgSaveVideo.OverwritePrompt = True dlgSaveVideo.DereferenceLinks = True dlgSaveVideo.CreatePrompt = True dlgSaveVideo.Filter =
"(*.mkv)|*.mkv|(*.mp4)|*.mp4|(*.flv)|*.flv|(*.avi)|*.av i|(*.wmv)|*.wmv|(*.mov)|*.mov|(*.mpeg)|*.mpeg|(*.vob)|* .vob"
txtSaveVideo.Text = dlgSaveVideo.FileName End Sub
Private Sub btnSave_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnSaveVideo.Click
dlgSaveVideo.ShowDialog() End Sub
Private Sub btnOpen_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnOpenVideo.Click
dlgOpenVideo.ShowDialog() End Sub
Private Sub dlgOpen_FileOk(ByVal sender As System.Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles dlgOpenVideo.FileOk
dlgOpenVideo.CheckFileExists = True
txtOpenVideo.Text = dlgOpenVideo.FileName End Sub
Private Sub btnStop_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnStopVideo.Click
On Error GoTo handle
If btnStartVideo.Enabled = False Then lblInfoVideo.Text = ("Konversi Dibatalkan!")
MsgBox("Konversi Akan Dibatalkan!",
MsgBoxStyle.Exclamation)
btnStartVideo.Enabled = True Else
MsgBox("Konversi Dimulai",
MsgBoxStyle.Critical) End If
proc.Kill() handle:
Exit Sub End Sub
Private Sub BackgroundWorkervideo_DoWork(ByVal sender As System.Object, ByVal e As
System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorkerVideo.DoWork
startConversion() End Sub
Private Sub btnHome_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles btnHomeVideo.Click
Me.Visible = False FrmMenu.Visible = True End Sub
End Class
Kode Program Menu Konversi Video
Public Class FrmTentang
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Visible = False FrmMenu.Visible = True End Sub