Global Allocation (Unmanaged Memory)

JaedenRuiner

Well-known member
Joined
Aug 13, 2007
Messages
340
Programming Experience
10+
In C# (which has allowance for C++ type casting) you can do certain things. I was wondering if there is a way to do this sort of "address assignment" in VB.

VB.NET:
      Dim ptr As IntPtr = Marshal.AllocHGlobal(8192)
      Dim b() As Byte

' C# style code below
      b = (Byte *) ptr

Basically, i have the Pointer to a global handle for memory, but I want to use it, but one can't really do much in VB without typing it, so the question then becomes if I can Alloc a Global via Marshalling how can i use that IntPtr?
Thanks
 
Use the other Marshal class methods to read/write to that memory location.
 
Back
Top