VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



How to Append a file to an EXE

by Adriaan Putter (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

This is just to show you how to append a file to an executable. Could be handy if you wanna save maybe a tag to your exe file. Have not test it with very large files but small file works perfectly.

Side Effects
There could be problems with large files, I dont know.

Rate How to Append a file to an EXE

Private Sub AppendToExe(exefile$,filetoappend$)
  Open filetoappend$ For Binary As #1
  filedata$ = String(LOF(1), " ")
  Get #1, , filedata$
  Close #1
  Open exefile$ For Binary As #1
  f = LOF(1)
  Seek #1, f + 1
  Put #1, , "WAP"   'any identifer
  Put #1, , filedata$
  Close #1
  
End Sub
Private Sub ExtractFromExe(exefile$,filetoextr$)
  Open exefile$ For Binary As #1
  filedata$ = String(LOF(1), " ")
  Get #1, , filedata$
  Close #1
  pos = InStr(1, filedata$, "WAP")
  f$ = Mid$(filedata$, pos + 3)
  
  Open filetoextr$ For Binary As #2
  Put #2, , f$
  Close #2
    
End Sub

Download this snippet    Add to My Saved Code

How to Append a file to an EXE Comments

No comments have been posted about How to Append a file to an EXE. Why not be the first to post a comment about How to Append a file to an EXE.

Post your comment

Subject:
Message:
0/1000 characters