Para probar esto debes:
1 - Crea un proyecto exe
2 - Pone en un formulario una textbox
3 - Setea la propiedad Multiline = true
4 - Cambia el font a Courrier new de 8 ( o cualquier Font no proporcionado
)
5 - La textbox debe tener un ancho de 6900 y un alto de 3000 mas o menos.
6 - La textbox se debe llamar txtMoni.
Este ejemplo convierte una string a hexa y muestra en lineas de 16 bytes,
numera las lineas y a la derecha muestra el texto original.
Probalo, luego modificalo para que use Byte array en vez de string. ( Si
usas string para leer el archivo algunos caracteres serán convetidos )
En el codigo del formulario pega esto:
Dim miBuffer As String
Private Function xHexa(dChar As String) As String
Dim y As Integer
Dim d As Integer
For y = 1 To Len(dChar)
d = InStr(y, dChar, " ")
If d Then Mid(dChar, d, 1) = "0"
Next
xHexa = dChar
End Function
Private Sub Form_Load()
Monitor "kljkljlkj klj kl jkl jkljlkjklj lk"
End Sub
Private Sub Monitor(miIng As String)
Static xPunt As Integer
Static xLin As Integer
Static xText As String * 16
Static xHex As String * 33
Dim mLin As String * 58
Dim xChar As String
Dim x As Integer
'If chkMonit.Value <> 1 Then Exit Sub
If miIng = "INIT_" Then
xPunt = 0
xLin = 0
xText = ""
xHex = ""
Exit Sub
End If
If Len(miBuffer) > 30000 Then
xPunt = 0
xLin = 0
xText = ""
xHex = ""
miBuffer = ""
End If
For x = 1 To Len(miIng)
DoEvents
Select Case xPunt
Case 0
If xLin = 255 Then xLin = 0
xHex = Space(33)
xChar = Mid(miIng, x, 1)
Mid(xHex, 1, 2) = xHexa(Format(Hex(Asc(xChar)), "@@"))
xText = IIf(Asc(xChar) > 31, xChar, ".")
mLin = xHexa(Format(Hex(xLin), "@@")) & "| " & xHex & " | "
& xText & vbCr & vbLf
miBuffer = miBuffer & mLin
xLin = xLin + 1
xPunt = xPunt + 1
Case 1 To 7
xChar = Mid(miIng, x, 1)
Mid(xHex, 1 + (xPunt * 2), 2) =
xHexa(Format(Hex(Asc(xChar)), "@@"))
Mid(xText, 1 + xPunt, 1) = IIf(Asc(xChar) > 31, xChar, ".")
mLin = xHexa(Format(Hex(xLin), "@@")) & "| " & xHex & " | "
& xText & vbCr & vbLf
miBuffer = Mid(miBuffer, 1, Len(miBuffer) - 58) & mLin
xPunt = xPunt + 1
Case 8 To 14
xChar = Mid(miIng, x, 1)
Mid(xHex, 2 + (xPunt * 2), 2) =
xHexa(Format(Hex(Asc(xChar)), "@@"))
Mid(xText, 1 + xPunt, 1) = IIf(Asc(xChar) > 31, xChar, ".")
mLin = xHexa(Format(Hex(xLin), "@@")) & "| " & xHex & " | "
& xText & " | " & vbCr & vbLf
miBuffer = Mid(miBuffer, 1, Len(miBuffer) - 58) & mLin
xPunt = xPunt + 1
Case 15
xChar = Mid(miIng, x, 1)
Mid(xHex, 2 + xPunt * 2, 2) = xHexa(Format(Hex(Asc(xChar)),
"@@"))
Mid(xText, 1 + xPunt, 1) = xChar
mLin = xHexa(Format(Hex(xLin), "@@")) & "| " & xHex & " | "
& xText & vbCr & vbLf
miBuffer = Mid(miBuffer, 1, Len(miBuffer) - 58) & mLin
xPunt = 0
End Select
Next x
txtMoni = miBuffer
End Sub
Espero puedas utilizarlo, es una ejemplo, dentro tiene todo lo que
necesitas.
:D
Daniel Calvin
El día 10/03/08, Carina V. Barca <[EMAIL PROTECTED]> escribió:
>
>
> Si, esa era la idea, muchas gracias. Si me podes pasar la rutina me
> vendria barbaro.
> Gracias de nuevo por responder
>
> ------------------------------
> Date: Mon, 10 Mar 2008 12:11:09 -0300
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: [vbusers] Imagen a binario
>
> Queres ver la representación binaria del contenido?, algo asi como:
>
> 2E 33 FE ......
>
> Esa estu idea?
>
> Te puedo mandar una rutina que convierte un array de bytes a su
> representación hexadecimal.
>
>
> Daniel Calvin
>
> 2008/3/10, Carina V. Barca <[EMAIL PROTECTED]>:
>
> Gracias por responder. Quiero poder ver ese binario y no la imagen.
> Saludos
>
>
> ------------------------------
> Date: Mon, 10 Mar 2008 11:27:02 -0300
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: [vbusers] Imagen a binario
>
> Hola Carina
>
> No entiendo bien tu pregunta. Un archivo bmp ojpg es una archivo binario.
> Que necesitas hacer?, que es lo que buscas especificamente?
>
> Saludos
>
> Daniel Calvin
>
> El día 10/03/08, *Carina V. Barca* <[EMAIL PROTECTED]> escribió:
>
> Buen dia: alquien tiene idea de como transformar un archivo de imagen
> (bmp, jpg.....) a un archivo binario?
>
> Muchas gracias
>
> ------------------------------
> Sigue los principales acontecimientos deportivos en directo. MSN
> Motor<http://video.msn.com/video.aspx?mkt=es-es>
>
>
>
>
> --
> Daniel A. Calvin
> Cooperator Team Member
> http://www.cooperator.com.ar
> Microsoft Certified Professional
>
>
> ------------------------------
> Sigue de cerca las últimas tendencias y lo que más rompe MSN
> Vídeo<http://video.msn.com/video.aspx?mkt=es-es>
>
>
>
>
> --
> Daniel A. Calvin
> Cooperator Team Member
> http://www.cooperator.com.ar
> Microsoft Certified Professional
>
>
> ------------------------------
> Sigue al minuto las principales noticias de tu ciudad MSN
> Deportes<http://deportes.es.msn.com/>
>
--
Daniel A. Calvin
Cooperator Team Member
http://www.cooperator.com.ar
Microsoft Certified Professional