Description
Builds a blank structure to pass to a DLL which will then fill in the structure's elements.
Syntax
struct = Blank_Struct(structname)
Parameters
Many DLL functions, including some in the Windows API, take a pointer to a structure as an argument and use that pointer to set values in the structure. To call one of these functions, prototype the parameter as being LPCHAR (meaning a pointer to the first byte of something) and use Blank_Struct to generate a blank structure for the function to fill.
The structure definition must be pre-defined using the Define_Struct routine. The RECT struct for the example below is defined as follows:
See also
Build_Struct(), Define_Struct, Struct_Len(), Var_To_Struct(), Parse_Struct, Chapter 7: Calling DLL Functions from Basic+
Example
* assumes the structure called RECT has been defined as * above and the API function GetWindowRect has been defined in * DLL_USER32 (the 32 bit DLL) as: * VOID STDCALL GetWindowRect(HANDLE, LPCHAR) declare function Get_Property, Blank_Struct declare subroutine Parse_Struct, GetWindowRect hwnd = Get_Property(@window , 'HANDLE') rect = Blank_Struct('RECT') GetWindowRect(hwnd, rect) Parse_Struct (rect, 'RECT', left, top, right, bottom)