#AutoIt3Wrapper_Res_File_Add=1.gif, rt_rcdata, G2
#include "resources.au3"
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GIFAnimation.au3"
#include <WinAPI.au3>
#include <WinAPIRes.au3>
$sFile = @ScriptDir & "\1.gif"
$hGui = GUICreate("GIF Animation", 411, 211, -1, -1)
;~ $hGIF = _GUICtrlCreateGIF($sFile, "", 61, 10)
$G2 = GetResAsBinary()
$hGIF = _GUICtrlCreateGIF($G2, "", 61, 10)
GUISetState()
do
until GUIGetMsg() = -3
Func GetResAsBinary()
Local $hInstance, $hResource, $GlobalMemoryBlock, $MemoryPointer, $ResSize, $ResStruct, $G2Bin
If Not @Compiled Then Return SetError(1)
$hInstance = _WinAPI_GetModuleHandle(0)
;Получение указателя на ресурс:
$hResource = _WinAPI_FindResource( $hInstance, $RT_RCDATA, "G2")
$GlobalMemoryBlock = _WinAPI_LoadResource($hInstance, $hResource)
$MemoryPointer = _WinAPI_LockResource($GlobalMemoryBlock)
;Получение бинарных данных:
$ResSize = _WinAPI_SizeOfResource($hInstance, $hResource)
$ResStruct = DllStructCreate("byte[" & $ResSize & "]", $MemoryPointer)
$G2Bin = DllStructGetData($ResStruct, 1)
Return $G2Bin
EndFunc