teodoric666 Posted February 26, 2024 Posted February 26, 2024 hello I'm coming to ask you a huge favor I love start screens with fade in and out effects I'm French I don't know much about autoit the friend who gave me this effect died three months ago , I have the sources but I don't understand anything, I just think it's the resource.au3 file that's wrong? could you take a look if it's not too long thanks in advance I have the latest versions of autoit and scite but despite trying to tinker I can't find this global const error, a big thank you 'advance he had done a fade in and fade out really well there is a great example test.exe I have never been able to find an effect like that good-fade.rar
Zedna Posted February 26, 2024 Posted February 26, 2024 If you want to use Resources UDF with latest version of AutoIt then you have to download/use derived ResourcesEx UDF (by guinness) from here and slightly modify your AU3 scripts changes needed in your fade/test.au3: ;~ #include "resources.au3" #include "ResourcesEx.au3" ... ;~ $hImage = _ResourceGetAsImage("TEST_PNG_1") $hImage = _Resource_GetAsImage("TEST_PNG_1") Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
teodoric666 Posted February 26, 2024 Author Posted February 26, 2024 a big thank you at least I no longer have the errors just that the image is not displayed, in any case thank you for taking the time, thank you test-1-Fadin autoit.rar
Gianni Posted February 26, 2024 Posted February 26, 2024 no need to include "ResourcesEx.au3" just try replacing this line $hImage = _Resource_GetAsImage("TEST_PNG_1") with this other one $hImage = _GDIPlus_ImageLoadFromFile(".\test.png") teodoric666 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Solution teodoric666 Posted February 26, 2024 Author Solution Posted February 26, 2024 It seems simple when you know! thank you all it works it makes me happy that his work continues Really thank you everyone
Zedna Posted February 26, 2024 Posted February 26, 2024 (edited) Difference with this approach is that you have to distribute PNG image separately along with compiled EXE. With Resources UDF you have PNG image compiled inside EXE and use it from resources (inside EXE) so you distribute only EXE file. Edited February 26, 2024 by Zedna teodoric666 1 Resources UDF ResourcesEx UDF AutoIt Forum Search
teodoric666 Posted February 26, 2024 Author Posted February 26, 2024 I'm going to go further and I won't bother you any more so I'm starting to get a taste Autoit but it's complex if I want to bring the photo into my exe put it in a windows temp directory and display it afterwards? fileInstall("test.png", @tempDir & "\test.png") its good ? but to display it? $hImage = _GDIPlus_ImageLoadFromFile(".\1test.png") or $hImage = _GDIPlus_ImageLoadFromFile("1test.png") thank's
Zedna Posted February 26, 2024 Posted February 26, 2024 (edited) FileInstall will embed PNG image inside EXE at compile time and copy it from EXE to destination directory at run time. With Resources UDF you can use PNG directly from EXE without need of extracting image to disk at runtime. fileInstall("test.png", @tempDir & "\test.png") $hImage = _GDIPlus_ImageLoadFromFile(@tempDir & "\test.png") You would should also add deleting image after using it - in case of FileInstall() ... Edited February 26, 2024 by Zedna teodoric666 1 Resources UDF ResourcesEx UDF AutoIt Forum Search
teodoric666 Posted February 26, 2024 Author Posted February 26, 2024 lol my translator failed I understood that with the UDF and reshacker it included the image the rest is incidental and for the purposes of knowing thank you both
teodoric666 Posted February 26, 2024 Author Posted February 26, 2024 (edited) I added a wav sound, it seems correct or can we optimize it? well it seems to work deleting the file but can we have the sound at the same time as the logo display? very thank's #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\1.ico #AutoIt3Wrapper_Outfile=444.exe #AutoIt3Wrapper_Res_File_Add=C:\Users\Thierry\Desktop\top-forum\Fadin autoit\1.wav #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, splash.png, rcdata, TEST_PNG_1, 0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region #EndRegion #include "ResourcesEx.au3" #include <GDIPlus.au3> #Include <File.au3> #Include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstants.au3> #include <Sound.au3> FileInstall("1.wav", @TempDir & "\1.wav", 1) SoundPlay (@TempDir & ".\1.wav", 1) Opt("MustDeclareVars", 0) Global Const $AC_SRC_ALPHA = 1 Global $old_string = "", $runthis = "" Global $launchDir = @DesktopDir ; Load PNG file as GDI bitmap _GDIPlus_Startup() $hImage = _Resource_GetAsImage("TEST_PNG_1") ; Extract image width and height from PNG $width = _GDIPlus_ImageGetWidth ($hImage) $height = _GDIPlus_ImageGetHeight($hImage) ; Create layered window $GUI = GUICreate("Toro Loader", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED) SetBitMap($GUI, $hImage, 0) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() WinSetOnTop($gui,"",1) ;fade in png background for $i = 0 to 255 step 5 SetBitMap($GUI, $hImage, $i) sleep(20) next sleep(2000) ;fade out png background for $i = 255 to 0 step -5 SetBitMap($GUI, $hImage, $i) Sleep(20) next ; Release resources _WinAPI_DeleteObject($hImage) _GDIPlus_Shutdown() ; ==================================================================================================== ;=========================== ; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image. ; ==================================================================================================== ;=========================== Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) if ($hWnd = $GUI) and ($iMsg = $WM_NCHITTEST) then Return $HTCAPTION EndFunc ; ==================================================================================================== ;=========================== ; SetBitMap ; ==================================================================================================== ;=========================== Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize ) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth ($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha" , $iOpacity ) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC (0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC ($hMemDC) EndFunc ;Sleep (2000) FileDelete (@TempDir& ".\1.wav") Edited February 27, 2024 by teodoric666
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now