Parse_Struct subroutine

Description

Extracts elements from a structure into BASIC+ variables.

Syntax

Parse_Struct(struct, structname, element1 [, … element32])

Remarks

Use this function to parse a structure returned by a DLL function. Alternatively, the Struct_To_Var function can be used to convert a structure into a dynamic array 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 Build_Struct function.

The structure definition must be predefined using the Define_Struct routine.

See also

Build_Struct(), Struct_To_Var(), Var_To_Struct()

Example

/* assumes the structure called RECT has been defined as being composed of 4 "signed short" elements and the API function GetWindowRect has been defined in DLL_USER as:  
VOID PASCAL GetWindowRect(USHORT, LPCHAR) */

declare function Get_Property, Blank_Struct, GetWindowsRect
declare subroutine Parse_Struct

hwnd = Get_Property(@window, "HANDLE")
rect = Blank_Struct("RECT")
GetWindowsRect(hwnd, rect)
Parse_Struct(rect, "RECT", left, top, right, bottom)