DllStructPeek

Retrieves the value of a member of a DLL structure represented by a structure handle.

Syntax:

DllStructPeek( structure-handle, member-name  )

Parameters:

(i) structure-handle: dll Structure handle returned by the DllStructAlloc function.

(s) member-name: structure member name from the structure descriptor string used to create the structure-handle.

Returns:

(i/s/a) value of a member of a DLL structure represented by a structure-handle and member-name.

 

Usually, call the function after the structure handle has been passed as a parameter during a DLL entry point call to retrieve data suppled by the DLL entry point. The structure-handle parameter must be a value returned by the DllStructAlloc function and the member-name parameter must be one of the structure member names supplied in the member descriptor string used to create the handle.

The function returns a string when the member data type is 'lpstr' or 'lpwstr' and an array when array syntax is used on the member name in the descriptor string.  A string of decimal digits (a huge number) is returned for most 8 byte integer data types and a floating point number is returned for the 'double' and 'float' data types. Most other data types are represented by an integer return value.

Structure-handle

Dll Structure handle returned by the DllStructAlloc function.

Member-name

Structure member name from the structure descriptor string used to create the 'structure-handle' parameter.

Example:
;=========================================================
;   Create the structure
;   struct {
;      int            var1;
;      unsigned char  var2;
;      unsigned int   var3;
;      char           var4[128];
;      float          var5;
;   }
;=========================================================
descriptor = "int:var1 byte:var2 uint:var3 char:var4[128] float:var5"
structhandle = DllStructAlloc( descriptor )
;   Set data in the struct
DllStructPoke( structhandle, "var1", -1  )
DllStructPoke( structhandle, "var2", 255  )
DllStructPoke( structhandle, "var3", -1  )
DllStructPoke( structhandle, "var4", ArrayFromStr( "Hello World" )  )
DllStructPoke( structhandle, "var5", 99.0  )
;   Get data from the struct
Pause("var1", DllStructPeek( structhandle, "var1" ) )
Pause("var2", DllStructPeek( structhandle, "var2" ) )
Pause("var3", DllStructPeek( structhandle, "var3" ) )
Pause("var4", ArrayToStr( DllStructPeek( structhandle, "var4" ) ) )

Pause("var5", DllStructPeek( structhandle, "var5" ) ) ; Free all resources associated with a DLL structure handle. DllStructFree( structhandle ) Exit
See Also:

DataCast, DllCall, DllCallbackDestroy, DllCallCdecl, DllCall Additional information, Binary Operations, DllLoad, DllFree, DllHwnd, DllHinst, DllStructAlloc, DllStructFree, DllStructPoke, IntControl 77,  IntControl 96, IntControl 97, IntControl 98