elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  juntar dos archivos
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: juntar dos archivos  (Leído 1,511 veces)
elguast

Desconectado Desconectado

Mensajes: 110


Ver Perfil
juntar dos archivos
« en: 1 Agosto 2008, 13:28 pm »

me dice error en tiempo de ejecucion 52 nombre o numero de archivo:

Private Sub juntar_Click()
Dim Ap1 As String
Dim file As String
Dim Ext1 As String
Dim filed As String
Dim i As Integer
Dim nombre As String
If lista.ListCount < 2 Then
MsgBox "Seleciona más de un archivo", vbCritical, "Error"
Exit Sub
End If
ga.FileName = "Joiner"
ga.DialogTitle = "Guardar Como..."
ga.DefaultExt = "*.exe"
ga.ShowSave
FileCopy App.Path & "\stubb.dll", ga.FileName
For i = 0 To lista.ListCount - 1
Open lista.List(i) For Binary As #1
file = Space(LOF(1))
Get #1, , file
Close #1
filed = StrReverse(file)
file = ""
Text1.Text = lista.List(i)
Ext1 = Ext(Text1.Text)
nombre = Nam(Text1.Text)
Ap1 = Ap1 & "/separador/" & filed & "/separador/" & Ext1 & "/separador/" & nombre
Next
Open ga.FileName For Binary As #1
Seek (1), LOF(1) + 1
Put #1, , Ap1
Close #1
MsgBox "Archivos Juntados", vbOKOnly, "AVISO"
End Sub

a mi parecer lo tengo todo bien y no puedo juntar los dos archivos


En línea

cobein


Desconectado Desconectado

Mensajes: 759



Ver Perfil WWW
Re: juntar dos archivos
« Respuesta #1 en: 1 Agosto 2008, 14:16 pm »

Mira aca te de un ejemplo super simple para empaquetar archivos, lo arme en 5 min asi que no pretendas nada super, pero como base esta bien.

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.    Dim pbg As New PropertyBag
  5.  
  6.    SaveFile App.Path & "\text1.txt", StrConv("Test File 1", vbFromUnicode)
  7.    SaveFile App.Path & "\text2.txt", StrConv("Test File 2", vbFromUnicode)
  8.  
  9.    pbg.WriteProperty "File1", GetFile(App.Path & "\text1.txt")
  10.    pbg.WriteProperty "File2", GetFile(App.Path & "\text2.txt")
  11.  
  12.    Kill App.Path & "\text1.txt"
  13.    Kill App.Path & "\text2.txt"
  14.  
  15.    SaveFile App.Path & "\Pack.dat", pbg.Contents
  16.  
  17.    Set pbg = Nothing
  18.    Set pbg = New PropertyBag
  19.  
  20.    pbg.Contents = GetFile(App.Path & "\Pack.dat")
  21.  
  22.    SaveFile App.Path & "\text1.txt", pbg.ReadProperty("File1")
  23.    SaveFile App.Path & "\text2.txt", pbg.ReadProperty("File2")
  24.  
  25.    Kill App.Path & "\Pack.dat"
  26. End Sub
  27.  
  28. Private Function GetFile(sFile As String) As Byte()
  29.    Dim iFile As Long
  30.  
  31.    iFile = FreeFile
  32.    Open sFile For Binary Access Read As iFile
  33.    ReDim GetFile(LOF(iFile) - 1)
  34.    Get iFile, , GetFile
  35.    Close iFile
  36. End Function
  37.  
  38. Private Sub SaveFile(sFile As String, bvData() As Byte)
  39.    Dim iFile As Long
  40.  
  41.    iFile = FreeFile
  42.    Open sFile For Binary Access Write As iFile
  43.    Put iFile, , bvData
  44.    Close iFile
  45. End Sub
  46.  


En línea

http://www.advancevb.com.ar
Más Argentino que el morcipan
Aguante el Uvita tinto, Tigre, Ford y seba123neo
Karcrack es un capo.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[AYUDA] Juntar 2 o mas archivos EXE en 1 (no me refiero a crear autoextraibles)
Programación General
Noxware 6 3,547 Último mensaje 25 Abril 2014, 23:12 pm
por Noxware
Juntar varios archivos siempre resulta en un ejecutable¿?
Programación General
Baal_30 0 1,726 Último mensaje 7 Abril 2016, 13:13 pm
por Baal_30
juntar csv
Scripting
makinavaja3500 0 3,976 Último mensaje 15 Julio 2023, 13:47 pm
por makinavaja3500
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines