Creates the structure of two structures
#include <WinAPIMisc.au3>
_WinAPI_UnionStruct ( $tStruct1, $tStruct2 [, $sStruct = ''] )
$tStruct1 | The structure that contains the first source data. |
$tStruct2 | The structure that contains the second source data. |
$sStruct | [optional] The string representing the final structure (same as for the DllStructCreate() function). |
Success: | "byte[n]" structure that contains the union data of the $tStruct1 and $tStruct2. |
Failure: | Sets the @error flag to non-zero. |
Important, you have to take into account the alignments of the structures. For example, "byte" & "dword" is
not equivalent to "byte;dword", but equivalent to "align 1;byte;dword".
#include <WinAPIMem.au3>
#include <WinAPIMisc.au3>
_Example()
Func _Example()
Local $tStruct1 = DllStructCreate('byte[4]')
_WinAPI_FillMemory($tStruct1, 4, 0xAA)
Local $tStruct2 = DllStructCreate('byte[4]')
_WinAPI_FillMemory($tStruct2, 4, 0xDD)
Local $tStruct3 = _WinAPI_UnionStruct($tStruct1, $tStruct2)
ConsoleWrite('First: ' & DllStructGetData($tStruct1, 1) & @CRLF)
ConsoleWrite('Second: ' & DllStructGetData($tStruct2, 1) & @CRLF)
ConsoleWrite('Union: ' & DllStructGetData($tStruct3, 1) & @CRLF)
EndFunc ;==>_Example