Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Struct_To_Var function ====== ==== Description ==== Converts a binary structure to a dynamic array, placing each element from the structure into the corresponding field. ==== Syntax ==== //var// = **Struct_To_Var**(//struct, structname//) ==== Parameters ==== Use Struct_To_Var when you want to convert a structure into an @fm-delimited array and none of the structure elements are char or char array types containing character values greater than an @vm (hex FD, decimal 253). Alternatively, use Parse_Struct to parse a structure into separate variables. This function is the opposite of the [[var_to_struct|Var_To_Struct function]]. The structure definition must be predefined using the [[define_struct|Define_Struct routine]]. ==== See Also ==== [[define_struct|Define_Struct]], [[parse_struct|Parse_Struct]], [[var_to_struct|Var_To_Struct()]] ==== Example ==== <code> /* 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, GetWindowsRect declare function Blank_Struct, Struct_To_Var hwnd = Get_Property(@window, "HANDLE") rect = Blank_Struct("RECT") GetWindowsRect(hwnd, rect) Size = Struct_To_Var(rect, "RECT") * build the SIZE property out of the returned rectangle Size<3> = Size<3> - Size<1> ;* convert right to width Size<4> = Size<4> - Size<2> ;* convert bottom to height ** ** </code> guides/programming/programmers_reference_manual/struct_to_var.txt Last modified: 2024/06/19 20:20by 127.0.0.1