TroubleShooting varptr

  • Thread starter Thread starter Mystic_Slayer
  • Start date Start date
M

Mystic_Slayer

Guest
Hello All,

ive just upgraded my code from Visual Basic 6 to Visual Basic.net.
But have Some probs with it:

Ive used the following code:

Private Function SwapEndian(ByVal dw As Long) As Long
CopyMemory(VarPtr(SwapEndian) + 3, dw, 1)
CopyMemory(VarPtr(SwapEndian) + 2, VarPtr(dw) + 1, 1)
CopyMemory(VarPtr(SwapEndian) + 1, VarPtr(dw) + 2, 1)
CopyMemory(VarPtr(SwapEndian, VarPtr(dw) + 3, 1)
End Function

Ive got the problem in Visual Basic.net that my VarPtr is not Valid.
What Can I do To Solve This Problem?

Allready thanks
 
Code:
Dim i As Int32 = 32000, ii As Int32, c As Int32
Dim b As Byte() = System.BitConverter.GetBytes(i), bb As Byte() : ReDim bb(3)

bb(0) = b(3)
bb(1) = b(2)
bb(2) = b(1)
bb(3) = b(0)

ii = System.BitConverter.ToInt32(bb, 0)
 
I need the function for the environment variable for Windows.
So I made this, but were upgrading from 6 to .net
 
Back
Top