|
-
Jun 11th, 2009, 03:44 AM
#1
Thread Starter
Lively Member
Merging Files
I lost the code to a program I made quite a while back so I was wondering if any one could help.
I have a list box which has file locations loaded into it by the user
After they are loaded they click the merge button and it joins all the files loaded into the listbox into 1 exe
I have this code I upgraded from vb6. I think it is joining the files but only the first one in the list is opening when i run the new exe that is made when they are merged
Code:
Dim sfd As New SaveFileDialog
If sfd.ShowDialog() = DialogResult.OK Then
Dim incoming As String
FileOpen(1, sfd.FileName, OpenMode.Append)
For i = 0 To ListBox1.Items.Count - 1
FileOpen(2, Me.ListBox1.Items.Item(i), OpenMode.Binary)
incoming = Space(LOF(2))
FileGet(2, incoming)
FileClose(2)
PrintLine(1, incoming)
Next i
FileClose(1)
End If
-
Jun 11th, 2009, 04:12 AM
#2
Re: Merging Files
What are the actual files you are "merging"?
It seems an odd thing to try and combine executable files together in this manner - I'm pretty surprised that anything runs at all, but if it does run something I can't see how you could possibly expect it to execute anything other than just the first EXE in the new merged file.
A little more explanation is needed I think.
-
Jun 11th, 2009, 04:16 AM
#3
Thread Starter
Lively Member
Re: Merging Files
 Originally Posted by keystone_paul
What are the actual files you are "merging"?
It seems an odd thing to try and combine executable files together in this manner - I'm pretty surprised that anything runs at all, but if it does run something I can't see how you could possibly expect it to execute anything other than just the first EXE in the new merged file.
A little more explanation is needed I think.
well this isn't the original code i used when i first made the program a year or so ago.
-
Jun 11th, 2009, 04:28 AM
#4
Re: Merging Files
Can you explain what you are expecting?
As far as I can see your code will take two files and join them together, but if you were to combine say "notepad.exe" and "calculator.exe" into a single executable in this manner, what are you expecting to happen when you run the new executable?
-
Jun 11th, 2009, 04:34 AM
#5
Thread Starter
Lively Member
Re: Merging Files
I expect them to both open
-
Jun 11th, 2009, 04:45 AM
#6
Re: Merging Files
That simply isn't possible. An executable file has only one starting point so there's no way it is going to run them both.
You could write a program that embedded executables as resources and at runtime extracted each one and ran it, but that is not the same as just merging two existing executables into one.
Last edited by keystone_paul; Jun 11th, 2009 at 04:50 AM.
-
Jun 11th, 2009, 07:33 AM
#7
Re: Merging Files
You coud write a small executable that attaches other executables to itself, binary style and stores the lengths of the executables, the breaks pieces of itself off as necessary and runs them.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|