#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=00000.png, PNG, 200
#AutoIt3Wrapper_Res_File_Add=00001.png, PNG, 201
#AutoIt3Wrapper_Res_File_Add=00002.png, PNG, 202
#AutoIt3Wrapper_Res_File_Add=00003.png, PNG, 203
#AutoIt3Wrapper_Res_File_Add=00004.png, PNG, 204
#AutoIt3Wrapper_Res_File_Add=00005.png, PNG, 205
#AutoIt3Wrapper_Res_File_Add=00006.png, PNG, 206
#AutoIt3Wrapper_Res_File_Add=00007.png, PNG, 207
#AutoIt3Wrapper_Res_File_Add=00008.png, PNG, 208
#AutoIt3Wrapper_Res_File_Add=00009.png, PNG, 209
#AutoIt3Wrapper_Res_File_Add=00010.png, PNG, 210
#AutoIt3Wrapper_Res_File_Add=00011.png, PNG, 211
#AutoIt3Wrapper_Res_File_Add=00012.png, PNG, 212
#AutoIt3Wrapper_Res_File_Add=00013.png, PNG, 213
#AutoIt3Wrapper_Res_File_Add=00014.png, PNG, 214
#AutoIt3Wrapper_Res_File_Add=00015.png, PNG, 215
#AutoIt3Wrapper_Res_File_Add=00016.png, PNG, 216
#AutoIt3Wrapper_Res_File_Add=00017.png, PNG, 217
#AutoIt3Wrapper_Res_File_Add=00018.png, PNG, 218
#AutoIt3Wrapper_Res_File_Add=00019.png, PNG, 219
#AutoIt3Wrapper_Res_File_Add=00020.png, PNG, 220
#AutoIt3Wrapper_Res_File_Add=00021.png, PNG, 221
#AutoIt3Wrapper_Res_File_Add=00022.png, PNG, 222
#AutoIt3Wrapper_Res_File_Add=00023.png, PNG, 223
#AutoIt3Wrapper_Res_File_Add=00024.png, PNG, 224
#AutoIt3Wrapper_Res_File_Add=00025.png, PNG, 225
#AutoIt3Wrapper_Res_File_Add=00026.png, PNG, 226
#AutoIt3Wrapper_Res_File_Add=00027.png, PNG, 227
#AutoIt3Wrapper_Res_File_Add=00028.png, PNG, 228
#AutoIt3Wrapper_Res_File_Add=00029.png, PNG, 229
#AutoIt3Wrapper_Res_File_Add=00030.png, PNG, 230
#AutoIt3Wrapper_Res_File_Add=00031.png, PNG, 231
#AutoIt3Wrapper_Res_File_Add=00032.png, PNG, 232
#AutoIt3Wrapper_Res_File_Add=00033.png, PNG, 233
#AutoIt3Wrapper_Res_File_Add=00034.png, PNG, 234
#AutoIt3Wrapper_Res_File_Add=00035.png, PNG, 235
#AutoIt3Wrapper_Res_File_Add=00036.png, PNG, 236
#AutoIt3Wrapper_Res_File_Add=00037.png, PNG, 237
#AutoIt3Wrapper_Res_File_Add=00038.png, PNG, 238
#AutoIt3Wrapper_Res_File_Add=00039.png, PNG, 239
#AutoIt3Wrapper_Res_File_Add=00040.png, PNG, 240
#AutoIt3Wrapper_Res_File_Add=00041.png, PNG, 241
#AutoIt3Wrapper_Res_File_Add=00042.png, PNG, 242
#AutoIt3Wrapper_Res_File_Add=00043.png, PNG, 243
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <File.au3>
#include <Array.au3>
#include <APIConstants.au3>
#include <Misc.au3>
#include <GDIPlus.au3>
#include <WinAPIEx.au3>
Opt('TrayMenuMode', 1)
Global Const $hAutoIt = WinGetHandle(AutoItWinGetTitle())
Global $ahPng, $aTmp[1], $aSize, $hPng, $hInstance
If @Compiled Then
$hInstance = _WinAPI_GetModuleHandle(0)
Dim $ahPng[45] = [44]
_GDIPlus_Startup()
For $i = 1 To $ahPng[0]
$hPng = _LoadResourceImage($hInstance, 'PNG', 199 + $i)
If Not IsArray($aSize) Then $aSize = _GDIPlus_ImageGetDimension($hPng)
$ahPng[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng)
_GDIPlus_ImageDispose($hPng)
$hPng = 0
Next
Else
$ahPng = _FileListToArray(@ScriptDir, '*.png', 1)
If @error Then Exit 13
ReDim $aTmp[$ahPng[0] + 1][2]
For $i = 1 To $ahPng[0]
$aTmp[$i][0] = $ahPng[$i]
$aTmp[$i][1] = Int(StringRegExpReplace($aTmp[$i][0], '[^\d]', ''))
Next
_ArraySort($aTmp, 0, 1, 0, 1)
_GDIPlus_Startup()
For $i = 1 To $ahPng[0]
$hPng = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\' & $aTmp[$i][0])
If Not IsArray($aSize) Then $aSize = _GDIPlus_ImageGetDimension($hPng)
$ahPng[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng)
_GDIPlus_ImageDispose($hPng)
$hPng = 0
Next
$aTmp = 0
EndIf
$hPng = 0
_GDIPlus_Shutdown()
$hPopup = GUICreate('', $aSize[0], $aSize[1], -1, -1, BitOR($WS_DISABLED, $WS_POPUPWINDOW), BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), $hAutoIt)
$iExit = TrayCreateItem('Exit')
Do
If _IsPressed('01') Then
_Animate()
EndIf
Until TrayGetMsg() = $iExit
For $i = 1 To $ahPng[0]
_WinAPI_DeleteObject($ahPng[$i])
Next
Func _Animate()
GUISetState(@SW_SHOWNOACTIVATE, $hPopup)
For $i = 0 To 255
_WinAPI_UpdateLayeredWindowEx($hPopup, -1, -1, $ahPng[1], $i)
Sleep(1)
Next
For $i = 1 To $ahPng[0]
_WinAPI_UpdateLayeredWindowEx($hPopup, -1, -1, $ahPng[$i])
Sleep(100)
Next
For $i = $ahPng[0] To 1 Step -1
_WinAPI_UpdateLayeredWindowEx($hPopup, -1, -1, $ahPng[$i])
Sleep(100)
Next
For $i = 255 To 0 Step -1
_WinAPI_UpdateLayeredWindowEx($hPopup, -1, -1, $ahPng[1], $i)
Sleep(1)
Next
_WinAPI_UpdateLayeredWindowEx($hPopup, -1, -1, 0, 0)
GUISetState(@SW_HIDE, $hPopup)
EndFunc ;==>_Animate
Func _GDIPlus_ImageGetDimension($hImage)
Local $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hImage, 'float*', 0, 'float*', 0)
If @error Then
Return SetError(1, 0, 0)
Else
If $aRet[0] Then
Return SetError(1, $aRet[0], 0)
EndIf
EndIf
Local $aResult[2]
$aResult[0] = $aRet[2]
$aResult[1] = $aRet[3]
Return $aResult
EndFunc ;==>_GDIPlus_ImageGetDimension
Func _LoadResourceImage($hInstance, $sResType, $sResName, $iResLanguage = 0)
Local $hInfo, $hData, $pData, $iSize, $hMem, $pMem, $hStream, $hImage
If $iResLanguage Then
$hInfo = _WinAPI_FindResourceEx($hInstance, $sResType, $sResName, $iResLanguage)
Else
$hInfo = _WinAPI_FindResource($hInstance, $sResType, $sResName)
EndIf
$hData = _WinAPI_LoadResource($hInstance, $hInfo)
$iSize = _WinAPI_SizeOfResource($hInstance, $hInfo)
$pData = _WinAPI_LockResource($hData)
If @error Then
Return SetError(1, 0, 0)
EndIf
$hMem = DllCall("kernel32.dll", "ptr", "GlobalAlloc", "uint", 2, "ulong_ptr", $iSize)
If @error Then
Return SetError(1, 0, 0)
EndIf
$pMem = DllCall("kernel32.dll", "ptr", "GlobalLock", "ptr", $hMem[0])
If @error Then
Return SetError(1, 0, 0)
EndIf
DllCall("kernel32.dll", "none", "RtlMoveMemory", "ptr", $pMem[0], "ptr", $pData, "ulong_ptr", $iSize)
DllCall("kernel32.dll", "int", "GlobalUnlock", "ptr", $hMem[0])
$hStream = _WinAPI_CreateStreamOnHGlobal($hMem[0])
If @error Then
Return SetError(1, 0, 0)
EndIf
_GDIPlus_Startup()
$hImage = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "ptr*", 0)
If (@error) Or ($hImage[0]) Or (Not $hImage[2]) Then
$hImage = 0
EndIf
_GDIPlus_Shutdown()
DllCall("kernel32.dll", "ptr", "GlobalFree", "ptr", $hMem[0])
If Not IsArray($hImage) Then
Return SetError(1, 0, 0)
EndIf
Return $hImage[2]
EndFunc ;==>_LoadResourceImage