You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chris A edited this page Aug 9, 2026
·
2 revisions
offset% = OffsetOf ( TypeName\field )
Returns the byte offset of field within TypeName, as a constant Int. Unlike AddressOf, this doesn't need a live instance, as it works directly off the type declaration
Type MyType
Field A%
Field B$
Field C#
End Type
debuglog OffsetOf(MyType\A) ; 0
debuglog OffsetOf(MyType\B) ; 4
debuglog OffsetOf(MyType\C) ; 8
Combine with AddressOf and PtrPeekInt/PtrPokeInt to reach a field from a raw object address instead of going through \field directly:
Local obj.MyType = New MyType
Local base% = AddressOf obj\A
Local bOffset% = OffsetOf(MyType\B)
PtrPokeInt base% + bOffset%, 123
debuglog obj\B ; 123