Core Function DllStructGetSize

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> DllStructGetSize( <dllstruct> ) </pre> === Description === Returns the size of the struct in bytes. === Parameters === ==== dllstruct ==== The struct returned by DLLS...")
 
m (1 revision)
 
(2 intermediate revisions by one user not shown)
Line 17: Line 17:
 
Success: The size of the struct in bytes.
 
Success: The size of the struct in bytes.
  
Failure: 0.
+
Failure: -1.
  
 
=== Remarks ===
 
=== Remarks ===

Latest revision as of 12:38, 14 June 2015

DllStructGetSize( <dllstruct> )

Contents

Description

Returns the size of the struct in bytes.

Parameters

dllstruct

The struct returned by DLLStructCreate.

Return Value

Success: The size of the struct in bytes.

Failure: -1.

Remarks

Used in DLLCall.

Example

/*=========================================================
   Create the struct
   struct {
       int             var1;
       unsigned char   var2;
       unsigned int    var3;
       char            var4[128];
   }
=========================================================*/
 
$str		= "int var1;ubyte var2;uint var3;char var4[128]";
$a			= DllStructCreate($str);
if ( !$a )
{
	MsgBox("Error in DllStructCreate");
	exit();
}
 
/*=========================================================
	Set data in the struct
	struct.var1	= -1;
	struct.var2	= 255;
	struct.var3	= 777;
	strcpy(struct.var4,"Hello");
	struct.var4[0]	= 'h';
=========================================================*/
DllStructSetData($a,"var1",-1);
DllStructSetData($a,"var2",255);
DllStructSetData($a,"var3",777);
DllStructSetData($a,"var4","Hello");
DllStructSetData($a,"var4","G",0);
 
/*=========================================================
	Display info in the struct
;=========================================================*/
MsgBox("Struct Size: " . DllStructGetSize($a) . @CRLF .
		"Struct pointer: " . DllStructGetPtr($a) . @CRLF .
		"Data:" . @CRLF .
		DllStructGetData($a,"var1") . @CRLF .
		DllStructGetData($a,"var2") . @CRLF .
		DllStructGetData($a,"var3") . @CRLF .
		DllStructGetData($a,"var4"),
		"DllStruct");
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox