README.md

December 5, 2022 ยท View on GitHub

undocumented varptr in vb7

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
ByIzek_S
LevelIntermediate
User Rating5.0 (45 globes from 9 users)
CompatibilityVB.NET
CategoryCoding 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