10 Years of Service
87%
So, here is the code for a simple .exe builder with stub.
Builder: (2 TextBoxes and a Button are needed)
Stub: (2 TextBoxes are used)
Builder: (2 TextBoxes and a Button are needed)
Code:
>Public Class Form1
Const FileSplit As String = "|level23|"
Dim stub, text, text2 As String
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sfd As New SaveFileDialog
sfd.Filter = "Executables(.exe)|*.exe"
If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
text = TextBox1.Text
text2 = TextBox2.Text
Else
Exit Sub
End If
FileOpen(1, System.Windows.Forms.Application.StartupPath & "/Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
stub = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
FileOpen(1, sfd.FileName, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
FilePut(1, stub & FileSplit & text & FileSplit & text2)
FileClose(1)
End
End Sub
End Class
Code:
>Public Class Form1
Const FileSplit As String = "|level23|"
Dim stub, text, text2, opt() As String
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
On Error Resume Next
FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)
stub = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
opt = Split(stub, FileSplit)
text = opt(1)
text2 = opt(2)
TextBox1.Text = text
TextBox2.Text = text2
End Sub
End Class