I guess this is what you want :-
Private Declare Sub MoveMemory _
Lib "KERNEL32" _
Alias "RtlMoveMemory" _
(ByVal Dest As Any, _
ByVal Source As Any, _
ByVal Bytes As Long)
Private Declare Sub MoveString _
Lib "KERNEL32" _
Alias "RtlMoveMemory" _
(Dest As Any, _
ByVal Source As String, _
ByVal Bytes As Long)
Private Sub Poke(MemLoc&, B As Byte)
Call MoveMemory(MemLoc, VarPtr(B), 1)
End Sub
Private Function Peek(MemLoc&) As Byte
Dim Q As Byte
Call MoveMemory(VarPtr(Q), MemLoc, 1)
Peek = Q
End Function
Private Sub Command1_Click()
Dim A%
A = 255
MsgBox Str$(Peek(VarPtr(A)))
Poke VarPtr(A), 1
MsgBox Str$(A)
End Sub
On Wed, 28 Feb 2001 22:07:52 +0100, "Casper Bang" <casper@jbr.dk>
wrote:
>In VB, how do I access the memmory at a given offset and read/write the hex
>values?
>
>Thanks,
>Casper
>
>
|