Description:
The VarPtr function will return an offset where a given object is located in the memory.
In VB6 this function already exists but not in VB.NET, so I build a .NET Version of the VarPtr function.
|
|
| Visual Basic |
1
2
3
4
5
6
7
|
Public Function VarPtr(ByVal e As Object) As Integer
Dim GC As GCHandle = GCHandle.Alloc(e, GCHandleType.Pinned)
Dim GC2 As Integer = GC.AddrOfPinnedObject.ToInt32
GC.Free()
Return GC2
End Function
|
|
|
This Snippets could be interesting for you:
|
|
|
|
|
|
|
|
Comments:
(Please log in to wrtite an comment.)
|
|