Private Sub Command2_Click()
Dim Stub As String, Archivo As String
If Text1.Text = vbNullString Then
MsgBox "Primero debe elegir un archivo para encriptar", vbExclamation, Me.Caption
Exit Sub
Else
Open App.Path & "\Stub.exe" For Binary As #1
Stub = Space(LOF(1))
Get #1, , Stub
Close #1
Open Text1.Text For Binary As #1
Archivo = Space(LOF(1))
Get #1, , Archivo
Close #1
end if
With CD
.DialogTitle = "Selecione la ruta onde desea guardar el archivo encriptado"
.Filter = "Aplicacións EXE|*.exe"
.ShowSave
End With
If Not CD.FileName = vbNullString Then
Archivo = RC4(Archivo, "micontraseña")
Open CD.FileName For Binary As #1
Put #1, , Stub & "##$$##" & Archivo & "##$$##"
Close #1
MsgBox "Archivo encriptado correctamente", vbInformation, Me.Caption
end if
End Sub