Funktionreferenz


_WinAPI_UnionStruct


Creates the structure of two structures

#include <WinAPIMisc.au3>
_WinAPI_UnionStruct ( $tStruct1, $tStruct2 [, $sStruct = ''] )

Parameter

$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).

Rückgabewert

Success: "byte[n]" structure that contains the union data of the $tStruct1 and $tStruct2.
Failure: Sets the @error flag to non-zero.

Bemerkungen

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".

Beispiel

#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('Erster:     ' & DllStructGetData($tStruct1, 1) & @CRLF)
    ConsoleWrite('Zweiter:    ' & DllStructGetData($tStruct2, 1) & @CRLF)
    ConsoleWrite('Allgemein:  ' & DllStructGetData($tStruct3, 1) & @CRLF)
EndFunc   ;==>_Example