#include <WinAPIEx.au3>
#include <Array.au3>
Local $aTest[Random(20, 40, 1)][Random(3, 6, 1)], $iCount
For $i = 0 To UBound($aTest) - 1
For $j = 0 To UBound($aTest, 2) - 1
$iCount += 1
$aTest[$i][$j] = $iCount
Next
Next
$iCount = 0
_ArrayDisplay($aTest, 'To buffer')
;~ --------------------------------------
;~ создали рандомный массив
;~ --------------------------------------
Local $iStep, $iNum, $pBuff
$iStep = UBound($aTest, 2)
$tStr = DllStructCreate('byte[' & $iStep * UBound($aTest) & ']')
For $i = 0 To UBound($aTest) - 1
For $j = 0 To $iStep - 1
$iNum += 1
DllStructSetData($tStr, 1, $aTest[$i][$j], $iNum)
Next
Next
$pBuff = _WinAPI_CreateBufferFromStruct($tStr)
$tStr = 0
$aTest = 0
;~ --------------------------------------
;~ поместили его в буфер
;~ --------------------------------------
Local $tStruct, $iTmp = 0, $aNew[1], $iSize
$iSize = _WinAPI_GetMemorySize($pBuff)
$tStruct = DllStructCreate('byte[' & $iSize & ']', $pBuff)
ReDim $aNew[$iSize / $iStep][$iStep]
For $i = 1 To DllStructGetSize($tStruct) - ($iStep - 1) Step $iStep
For $j = 0 To $iStep - 1
$aNew[$iTmp][$j] = DllStructGetData($tStruct, 1, $i + $j)
Next
$iTmp += 1
Next
_ArrayDisplay($aNew, 'From buffer')
;~ --------------------------------------
;~ из буфера поместили данные в массив
;~ --------------------------------------
_WinAPI_FreeMemory($pBuff)