Alright so I'm essentialyl trying to code something that will combine two files together in VB and output a single file that when run, runs both of them. I've grabbed this source from several places online and am just trying to get it to work. We have the main program that combines them with a GUI
Const FileSplit = "@<>#<>#<>@"
Private Sub cmdAdd_Click()
With Dlg
.Filter = "All Files(*.*) | *.*"
.DialogTitle = "Please Select a File..."
.ShowOpen
End With
lsFiles.AddItem (Dlg.FileName)
End Sub
Private Sub cmdBuild_Click()
Dim sStub As String, sFiles As String, i As Integer
Open App.Path & "\stub.exe" For Binary As #1
sStub = Space(LOF(1))
Get #1, , sStub
Close #1
Open App.Path & "\boundfile.exe" For Binary As #1
Put #1, , sStub & FileSplit
For i = 0 To lsFiles.ListCount - 1
Open lsFiles.List(i) For Binary As #2
sFiles = Space(LOF(2))
Get #2, , sFiles
Close #2
Put #1, , sFiles & FileSplit
Next i
Close #1
MsgBox "Files Successfully Combined"
End Sub
And then we have a second App that acts as a stub
Const FileSplit = "@<>#<>#<>@"
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Form_Load()
Dim sStub As String, sFiles() As String, i As Integer
Open App.Path & "\" & App.EXEName & ".exe" For Binary As #1
sStub = Input(LOF(1), 1)
Get #1, , stub
Close #1
sFiles = Split(sStub, FileSplit)
For i = 1 To UBound(sFiles())
Open Environ("tmp") & "\tmp" & i & ".exe" For Binary As #1
Put #1, , sFiles(i)
Close #1
Call ShellExecute(0, vbNullString, Environ("tmp") & "\tmp" & i & ".exe", vbNullString, vbNullString, vbNormalFocus)
Next i
End
End Sub
however when the files are combined and run all I get is a dosbox opening and closing. Any ideas?