Build_Struct function

 

Description

Assembles a binary structure out of BASIC+ variables.

Syntax

struct = Build_Struct(structname, element1 [, … element32])

Parameters

Use this function to build a structure to pass to a DLL function. Alternatively, the Var_To_Struct function can be used to convert a dynamic array into a structure as long as none of the elements are char or char array types containing character values greater than @VM (hex FD, decimal 253).

This function is the opposite of the Parse_Struct subroutine.

The structure definition must be pre-defined using the Define_Struct routine.

See also

Blank_Struct(), Define_Struct, Parse_Struct, Var_To_Struct(), Chapter 7

Example

/* assuming the structure called RECT has been defined as being composed of 4 "signed short" elements, this code builds a rectangle structure based on the location and size of an OpenInsight form. */

declare function Get_Property, Build_Struct
size   = Get_Property(@window, "SIZE")
left   = size<1>
top    = size<2>
right  = size<1> + size<3>
bottom = size<2> + size<4>
rect   = Build_Struct("RECT", left, top, right, bottom)