guides:programming:programmers_reference_manual:parse_struct

Parse_Struct subroutine

Extracts elements from a structure into BASIC+ variables.

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

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.

/* 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)
  • guides/programming/programmers_reference_manual/parse_struct.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1