class Struct extends Any
Struct is the base class for all structs.
Unlike Object, a struct's properties are limited to those defined by its base object (the Prototype of the struct's class). These are typically typed properties declared in a struct definition, but can include dynamic properties, methods and read-only value properties.
"Obj" is used below as a placeholder for any instance of the Struct class.
Instances of Struct are indirectly based on Struct.Prototype, which is based on Any.Prototype. In addition to the methods and properties inherited from Any, Structs have the following predefined methods and properties.
Creates a new Struct.
Obj := StructClass()
Obj := StructClass.Call()
StructClass must be a subclass of Struct. Subclasses can be created by a struct definition or at runtime.
Creates a boxed pointer, which behaves as an instance of StructClass.
Obj := StructClass.At(Address)
Type: Integer
The address of a struct of the type defined by StructClass.
Type: Object
StructClass must be a subclass of Struct.
See Boxed Pointer for further details.
Gets the Prototype on which all instances of the struct class are based.
Proto := ClassObj.Prototype
See ClassObj.Prototype for details.
Gets a class representing a pointer to a StructClass.
PtrClass := StructClass.Ptr
Type: Class
This is used with DllCall and typed properties.
See Pointers to Structs for further details.
Gets a class representing a fixed-size array of StructClass elements.
ArrayClass := StructClass[Length]
ArrayClass := StructClass.__Item[Length]
Type: Integer
The length of the array type.
Type: Class
The return value is a subclass of Struct.Array.
This is typically used with DllCall and typed properties.
Retrieves a nested struct or virtual reference to a property.
Obj.__Ref(Name)
Type: String
The property's name.
Type: Object
If the property is a nested struct, a reference to the struct is returned. The property corresponding to a nested struct can only be assigned a value if the struct defines a settable __Value property. The struct itself can also be used as a virtual reference in that case. An abstract data type typically implements both a getter and a setter, in which case the nested struct itself can only be retrieved via this method.
If the property is a pointer type or not a nested struct, a PropRef is created and returned.
This method is normally called indirectly via the reference operator. For example, &Obj.Prop is equivalent to Obj.__Ref('Prop').
A virtual reference can be passed to a ByRef parameter in place of a variable reference.
Gets the number of elements in a structured array.
ElementCount := Obj.Length
Type: Integer
This property applies to instances of fixed-size array classes such as Int32[4]. Accessing it on a struct which is not a structured array throws a PropertyError.
Gets the address of the struct.
Address := Obj.Ptr
Type: Integer
The address of a struct is the same as the address of its first field (typed property).