Guest Mystic_Slayer Posted October 28, 2002 Posted October 28, 2002 Hello All, i've just upgraded my code from Visual Basic 6 to Visual Basic.net. But have Some probs with it: I've 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 I've got the problem in Visual Basic.net that my VarPtr is not Valid. What Can I do To Solve This Problem? Allready thanks Quote
*Gurus* Derek Stone Posted October 28, 2002 *Gurus* Posted October 28, 2002 I have to ask, what are you using this for? It's rare to see a value in big-endian format. Quote Posting Guidelines
*Gurus* Derek Stone Posted October 28, 2002 *Gurus* Posted October 28, 2002 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) Quote Posting Guidelines
Guest Mystic_Slayer Posted October 29, 2002 Posted October 29, 2002 I need the function for the environment variable for Windows. So I made this, but we're upgrading from 6 to .net Quote
Recommended Posts