README.md
December 5, 2022 ยท View on GitHub
Description
VB6 has 3 undocumented functions. VarPtr, StrPtr, and ObjPtr.StrPtr returns object of a string, VarPtr returns address of any other variable and ObjPtr returns address of an object. In VB.Net these 3 functions are abosolete but their functionality is still avaliable.
More Info
| Submitted On | |
| By | Izek_S |
| Level | Intermediate |
| User Rating | 5.0 (45 globes from 9 users) |
| Compatibility | VB.NET |
| Category | Coding Standards |
| World | .Net (C#, VB.net) |
| Archive File |
Source Code
Public Function VarPtr(ByVal o As Object) As Integer
Dim GC As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(o, System.Runtime.InteropServices.GCHandleType.Pinned)
Dim ret As Integer = GC.AddrOfPinnedObject.ToInt32
GC.Free()
Return ret
End Function