by Jessy Butzke (11 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 28th September 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Ever want to open an executable but couldn't because of End Of File. Well this code opens executable files in binary and saves their machine
Dim strPath As String
'Code was created by Jessy Butzke
Private Sub Command1_Click()
Dim fso
Dim b As Byte
Set fso = CreateObject("Scripting.FileSystemObject")
With cmnDlg
.FileName = "*.exe"
.DefaultExt = "exe"
.DialogTitle = "Open Exe Files"
.Filter = "*.exe"
.ShowOpen
End With
If Trim(Me.cmnDlg.FileName$) <> "" Then
If fso.FileExists(Me.cmnDlg.FileName$) Then
Me.Label1.Caption$ = "Working..."
Me.Refresh
MsgBox "This might take a while to load. Please be patient.", vbInformation, "Notice"
Open Me.cmnDlg.FileName For Binary Access Read As #1
Open strPath$ & "Data.txt" For Binary Access Write As #2
Do While Not EOF(1)
Get #1, , b
Put #2, , b
DoEvents
Loop
Close #1
Close #2
Me.Label1.Caption$ = "Done"
Me.Refresh
MsgBox "A file named Data.txt has been generated at: " & strPath$ & ".", vbInformation, "Notice"
Else
MsgBox "The file that you are requesting does not exist.", vbCritical, "Error"
End If
End If
End Sub
Private Sub Form_Load()
If Len(App.Path) > 3 Then
strPath$ = App.Path & "\"
Else
strPath$ = App.Path
End If
End Sub
No comments have been posted about Ever want to open an executable but couldn't because of End Of File. Well this code opens executabl. Why not be the first to post a comment about Ever want to open an executable but couldn't because of End Of File. Well this code opens executabl.