siguiendo este tuto
http://foro.elhacker.net/programacion_visual_basic/memoria_en_vb-t114052.0.html
en la parte donde convierto el dword en cadena me sale otros caracteres los cuales no son ABCD como lo dice el tutorial aca hay una imagen
(http://picturestack.com/472/631/BzzDibujo24a.jpg)
la verdad no se cual es el error :huh:
habria que ver que hacen esas funciones que tenes ahi, pero porque no probas asi:
Private Sub Form_Load()
Dim bytes(3) As Byte
bytes(0) = 65
bytes(1) = 66
bytes(2) = 67
bytes(3) = 68
Debug.Print StrConv(bytes, vbUnicode)
End Sub
saludos.
Property Get HiByte(ByVal Word As Integer) As Byte
' Devuelve el Byte alto del Word especificado.
'
If Word And &H8000 Then
If Not (Word Or &HFF) = &HFFFFFFFF Then Word = (Word Xor &HFF)
HiByte = &H80 Or ((Word And &H7FFF) \ &HFF)
Else
HiByte = Word \ 256
End If
End Property
Property Get HiWord(Dword As Long) As Integer
' Devuelve el Word alto del DWord especificado.
'
If Dword And &H80000000 Then
HiWord = (Dword / 65535) - 1
Else
HiWord = Dword / 65535
End If
End Property
Property Get LoByte(Word As Integer) As Byte
' Devuelve el Byte bajo del Word especificado.
'
LoByte = (Word And &HFF)
End Property
Property Get LoWord(Dword As Long) As Integer
' Devuelve el Word bajo del DWord especificado.
'
If Dword And &H8000& Then
LoWord = &H8000 Or (Dword And &H7FFF&)
Else
LoWord = Dword And &HFFFF&
End If
End Property
Property Get MakeWord(ByVal bHi As Byte, ByVal bLo As Byte) As Integer
' Crea un Word a partir de sus dos componentes Byte.
'
If bHi And &H80 Then
MakeWord = (((bHi And &H7F) * 255) + bLo) Or &H7FFF
Else
MakeWord = (bHi * 255) + bLo
End If
End Property
Property Get MakeDWord(wHi As Integer, wLo As Integer) As Long
' Crea un DWord a partir de sus dos componentes Word.
'
If wHi And &H8000& Then
MakeDWord = (((wHi And &H8000&) * 65536) Or (wLo And &HFFFF&)) Or &H80000000
Else
MakeDWord = (wHi * &H10000) + wLo
End If
End Property
y la funcion
Function DWordToString(dw As Long) As String
DWordToString = Chr$(LoByte(LoWord(dw))) & _
Chr$(HiByte(LoWord(dw))) & _
Chr$(LoByte(HiWord(dw))) & _
Chr$(HiByte(HiWord(dw)))
End Function
Function StringToDWord(Str As String) As Long
If Len(Str) < 4 Then Str = Str & String$(4 - Len(Str), 0)
StringToDWord = MakeDWord( _
MakeWord( _
Asc(Mid$(Str, 4)), _
Asc(Mid$(Str, 3, 1)) _
), _
MakeWord( _
Asc(Mid$(Str, 2, 1)), _
Asc(Mid$(Str, 1, 1)) _
) _
)
End Function